WebSphere Enterprise Service Bus, Version 6.2.0 Operating Systems: AIX, HP-UX, i5/OS, Linux, Solaris, Windows


Java to XML conversion

The system generates XML based on Java types using predefined rules.

Converting between types

Table 1 shows how the system converts between Java™ types and XML. The system places the XML in the types section of a Web Services Description Language (WSDL) document.

Table 1. Conversion between Java and XML
Java type XML type
char or java.lang.Character
<ati:schema 
	targetNamespace="http://xml.apache.org/xml-soap"
xmlns="http://www.w3.org/2001/XMLSchema" 
xmlns:ati="http://www.w3.org/2001/XMLSchema">    
	<ati:simpleType name="char">     
		<ati:restriction base="xsd:string">      
			<ati:length value="1"/>     
		</ati:restriction>    
	</ati:simpleType>   
</ati:schema>  

tns2:char or tns2:char nillable = true
boolean xsd:boolean
java.lang.Boolean xsd:boolean nillable=true
byte or java.lang.Byte xsd:byte or xsd:byte nillable=true
short or java.lang.Short xsd:short or xsd:short nillable=true
int or java.lang.Integer xsd:int or xsd:int nillable = true
long or java.lang.Long xsd:long or xsd:long nillable=true
float or java.lang.Float xsd:float or xsd:float nillable=true
Double or java.lang.Double xsd:double or xsd:double nillable=true
java.lang.String xsd:string nillable=true
java.math.BigInteger xsd:integer nillable=true
Java.math.BigDecimal xsd:decimal nillable=true
Java.util.Calendar xsd:dateTime nillable=true
java.util.Date xsd:dateTime nillable=true
Java.xml.namespace.QName xsd:Qname nillable=true
java.net.URI xsd:anyURI nillable=true
byte[] xsd:base64Binary
Array of types xsd:complexType with an element of type and with maxocurrs > 1 or unbounded
Java class
Important: If the Java class is a user-defined class, the class must conform to section 5.4 of JAX-RPC 1.1.
xsd:complexType as per rules in section 5.4 of JAX-RPC 1.1
java.lang.Object xsd:anyType
java.util classes (such as Collection, List,ArrayList, Set, SortedSet, AbstractCollection, AbstractList, AbstractSet, Hashset LinkedHashSet, LinkedList, Stack, Treeset)
Important: Only the Java type collections listed are currently supported.
<complexType name="ArrayOfXSDAnyType">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" 
			name="anyType" nillable="true" 
			type="xsd:anyType"/>
    </sequence>
</complexType>
  • java.util.Map
  • java.util.HashMap
targetNamespace="http://xml.apache.org/xml-soap"    

<complexType name="Item">     
	<all>      
		<element name="key" type="xsd:anyType"/>      
		<element name="value" type="xsd:anyType"/>     
	</all>    
</complexType>    

<complexType name="Map">     
	<sequence>      
		<element maxOccurs="unbounded" minOccurs="0" 
		name="item" type="tns2:Item"/>     
	</sequence>    
</complexType>
java.util.Vector
targetNamespace="http://xml.apache.org/xml-soap" 

<complexType name="Vector">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" 
				name="item" type="xsd:anyType"/>
    </sequence>
</complexType>
java.util.types

Where types can be Arrays, SortedMap, AbstractMap, Bitset, Dictionary, IdentityHashmap, LinkedHashMap, TreeMap

This is not an exhaustive list of java.util types that could generate WSDL type xsd:anytype.

xsd:anytype
Object[] - array of Objects
<complexType name="ArrayOfXSDAnyType">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" 
			name="anyType" nillable="true" 
			type="xsd:anyType"/>
    </sequence>
</complexType>
You can override any generated conversion.

reference Reference topic

Terms of use | Feedback


Timestamp icon Last updated: 21 June 2010


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic//com.ibm.websphere.wesb620.doc/doc/rref_javatowsdltypemap.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
This information center is powered by Eclipse technology (http://www.eclipse.org).