IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Advanced development topics > Adding Java to the application > Use Java in the assembly editor

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 Definition Language (WSDL) document.

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

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: Collection, List,ArrayList, Set, SortedSet, AbstractCollection, AbstractList, AbstractSet, Hashset LinkedHashSet, LinkedList, Stack, Treeset
<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

The java.util types that could generate WSDL type xsd:anytype are not restricted to the ones in this list.

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 the generated conversion when necessary.

Use Java in the assembly editor


Related concepts:
SCA to Java bridge


Related tasks:
Create a Java component
Calling WSDL interfaces from Java references
Calling Java interfaces from WSDL references
Overriding the generated Service Component Architecture implementation
Overriding a Service Data Object (SDO) to Java conversion


Related reference:

Java API for XML-Based RPC (JAX-RPC) Documentation