Types
public Types(Definition def,
TypeMapping tm,
TypeMapping defaultTM,
Namespaces namespaces,
String targetNamespace,
List stopClasses,
ServiceDesc serviceDesc)
This class serailizes a Class
to XML Schema. The constructor
provides the context for the streamed node within the WSDL document
def
- WSDL Definition Element to declare namespacestm
- TypeMappingRegistry to handle known typesdefaultTM
- default TMnamespaces
- user defined or autogenerated namespace and prefix mapstargetNamespace
- targetNamespace of the documentstopClasses
- serviceDesc
-
Types
public Types(Definition def,
TypeMapping tm,
TypeMapping defaultTM,
Namespaces namespaces,
String targetNamespace,
List stopClasses,
ServiceDesc serviceDesc,
Emitter emitter)
This class serailizes a Class
to XML Schema. The constructor
provides the context for the streamed node within the WSDL document
def
- WSDL Definition Element to declare namespacestm
- TypeMappingRegistry to handle known typesdefaultTM
- default TMnamespaces
- user defined or autogenerated namespace and prefix mapstargetNamespace
- targetNamespace of the documentstopClasses
- serviceDesc
- emitter
- Java2Wsdl emitter
createArrayElement
public Element createArrayElement(String componentTypeName)
Method createArrayElement
createAttributeElement
public Element createAttributeElement(String elementName,
Class javaType,
QName xmlType,
boolean nullable,
Document docHolder)
throws AxisFault
Create Attribute Element with a given name and type
elementName
- the name of the created elementjavaType
- xmlType
- nullable
- nullable attribute of the elementdocHolder
-
createElement
public Element createElement(String elementName)
Create a DOM Element in this context
createElement
public Element createElement(String elementName,
String elementType,
boolean nullable,
boolean omittable,
Document docHolder)
Create Element with a given name and type
elementName
- the name of the created elementelementType
- schema type representation of the elementnullable
- nullable attribute of the elementomittable
- docHolder
-
createElementWithAnonymousType
public Element createElementWithAnonymousType(String elementName,
Class fieldType,
boolean omittable,
Document ownerDocument)
throws AxisFault
Write an <element> with an anonymous internal ComplexType
elementName
- fieldType
- omittable
- ownerDocument
-
createLiteralArrayElement
public Element createLiteralArrayElement(String componentType,
QName itemName)
Create an array which is a wrapper type for "item" elements
of a component type. This is basically the unencoded parallel to
a SOAP-encoded array.
componentType
- itemName
- the QName of the inner element (right now we only use the localPart)
getLocalNameFromFullName
public static String getLocalNameFromFullName(String full)
Utility method to get the local class name from a fully qualified java class name
getNamespaces
public Namespaces getNamespaces()
Return the namespaces object for the current context
getPackageNameFromFullName
public static String getPackageNameFromFullName(String full)
Utility method to get the package name from a fully qualified java class name
getQNameString
public String getQNameString(QName qname)
Return a string suitable for representing a given QName in the context
of this WSDL document. If the namespace of the QName is not yet
registered, we will register it up in the Definitions.
qname
- a QName (typically a type)
- a String containing a standard "ns:localPart" rep of the QName
getServiceDesc
public ServiceDesc getServiceDesc()
return the service description
getStopClasses
public List getStopClasses()
Return the list of classes that we should not emit WSDL for.
getTypeQName
public QName getTypeQName(Class javaType)
Return the QName of the specified javaType
javaType
- input javaType Class
insertTypesFragment
public void insertTypesFragment(Document doc)
Inserts the type fragment into the given wsdl document and ensures
that definitions from each embedded schema are allowed to reference
schema components from the other sibling schemas.
isAcceptableAsAttribute
public boolean isAcceptableAsAttribute(Class type)
Is the given class acceptable as an attribute
- true if the type is a simple, enum type or extends SimpleType
isArray
public static boolean isArray(Class clazz)
isBeanCompatible
protected boolean isBeanCompatible(Class javaType,
boolean issueErrors)
isBeanCompatible
javaType
- ClassissueErrors
- if true, issue messages if not compatible
Returns true if it appears that this class is a bean and
can be mapped to a complexType
isEnumClass
public static boolean isEnumClass(Class cls)
Returns true if indicated type matches the JAX-RPC enumeration class.
Note: supports JSR 101 version 0.6 Public Draft
isNullable
public static boolean isNullable(Class type)
Determines if the field is nullable. All non-primitives are nillable.
loadInputSchema
public void loadInputSchema(String inputSchema)
throws IOException,
WSDLException,
SAXException,
ParserConfigurationException
Loads the types from the input schema file.
inputSchema
- file or URL
loadInputTypes
public void loadInputTypes(String inputWSDL)
throws IOException,
WSDLException,
SAXException,
ParserConfigurationException
Load the types from the input wsdl file.
updateNamespaces
public void updateNamespaces()
Method updateNamespaces
writeElementDecl
public void writeElementDecl(QName qname,
Class javaType,
QName typeQName,
boolean nillable,
QName itemQName)
throws AxisFault
Create a top-level element declaration in our generated schema
qname
- javaType
- typeQName
- nillable
- nillable attribute of the elementitemQName
-
writeElementForPart
public QName writeElementForPart(Class type,
QName qname)
throws AxisFault
Write out an element referenced by a part element attribute.
type
- Class
to generate the XML Schema info forqname
- QName
of the element. If null, qname is
defaulted from the class.
- the QName of the generated Schema type, null if no element
writeEnumType
public Element writeEnumType(QName qName,
Class cls)
throws NoSuchMethodException,
IllegalAccessException,
AxisFault
Write Enumeration Complex Type
(Only supports enumeration classes of string types)
qName
- QName of type.cls
- class of type
writeSchemaElement
public void writeSchemaElement(String namespaceURI,
Element element)
throws AxisFault
Write out the given Element into the appropriate schema node.
If need be create the schema node as well
namespaceURI
- namespace this node should get dropped intoelement
- the Element to append to the Schema node
writeSchemaElement
public void writeSchemaElement(QName qName,
Element element)
throws AxisFault
Please use writeSchemaElement(String namespaceURI, Element element)
qName
- qName to get the namespace of the schema nodeelement
- the Element to append to the Schema node
writeSchemaElementDecl
public void writeSchemaElementDecl(QName qname,
Element element)
throws AxisFault
Method writeSchemaElementDecl
writeSchemaTypeDecl
public void writeSchemaTypeDecl(QName qname,
Element element)
throws AxisFault
Method writeSchemaTypeDecl
writeType
public String writeType(Class type)
throws AxisFault
Write a schema representation for the given
Class
. Recurse
through all the public fields as well as fields represented by java
bean compliant accessor methods.
Then return the qualified string representation of the generated type
type
- Class for which to generate schema
- a prefixed string for the schema type
writeType
public String writeType(Class type,
QName qName)
throws AxisFault
Write a schema representation for the given
Class
. Recurse
through all the public fields as well as fields represented by java
bean compliant accessor methods.
Then return the qualified string representation of the generated type
type
- Class for which to generate schemaqName
- of the type to write
- a prefixed string for the schema type or null if problems occur
writeTypeAndSubTypeForPart
public QName writeTypeAndSubTypeForPart(Class type,
QName qname)
throws AxisFault
Write out a type (and its subtypes) referenced by a part type attribute.
type
- Class
to generate the XML Schema info forqname
- QName
of the type. If null, qname is
defaulted from the class.
- the QName of the generated Schema type, null if void,
if the Class type cannot be converted to a schema type
then xsd:anytype is returned.
writeTypeForPart
public QName writeTypeForPart(Class type,
QName qname)
throws AxisFault
Write out a type referenced by a part type attribute.
type
- Class
to generate the XML Schema info forqname
- QName
of the type. If null, qname is
defaulted from the class.
- the QName of the generated Schema type, null if void,
if the Class type cannot be converted to a schema type
then xsd:anytype is returned.
writeWrappedParameter
public void writeWrappedParameter(Element sequence,
String name,
QName type,
Class javaType)
throws AxisFault
Write a parameter (a sub-element) into a sequence generated by
writeWrapperElement() above.
sequence
- the <sequence> in which we're writingname
- is the name of an element to add to the wrapper element.type
- is the QName of the type of the element.javaType
-
writeWrapperElement
public Element writeWrapperElement(QName qname,
boolean request,
boolean hasParams)
throws AxisFault
Write the element definition for a WRAPPED operation. This will
write out any necessary namespace/schema declarations, an an element
definition with an internal (anonymous) complexType. The name of the
element will be *foo*Request or *foo*Response depending on whether the
request boolean is true. If the operation contains parameters, then
we also generate a >sequence< node underneath the complexType,
and return it for later use by writeWrappedParameter() below.
qname
- the desired element QNamerequest
- true if we're writing the request wrapper, false if
writing the response.hasParams
- true if there are parameters, and thus a sequence
node is needed
- a DOM Element for the sequence, inside which we'll write the
parameters as elements, or null if there are no parameters