The Axis Java-to-Soap Function Component (FC) is part of the TDI Web Services suite.
Due to limitations of the Axis library used by this component only WSDL (http://www.w3.org/TR/wsdl) version 1.1 documents are supported. Furthermore, the supported message exchange protocol is SOAP 1.1.
This component can be used both on the web service client and on the web service server side. This component receives an Entry or a Java object and produces the SOAP request (when on the client) or response (when on the server) message. It will provide the whole SOAP message, as well as separately the SOAP Header and the SOAP Body to facilitate processing and customization.
The component supports both RPC and Document style.
If checked and the web service used is an RPC-style web service, the generated SOAP message will use multi-refs. If not checked and the web service used is an RPC-style web service, the generated SOAP message will not use multi-refs.
Entry or Java Object. If anything else is passed, an Exception is thrown.
An Entry object with 3 attributes - one for the whole SOAP message, one for the SOAP Header and one for the SOAP Body. The SOAP message, Body and Header will be either XML strings or DOM objects, as specified by the Return XML as parameter.
This Function Component (FC) serializes the Java representation of a SOAP message into the XML representation of that SOAP message.
The presence of the Use Multi Refs parameter is a consequence of using the Axis library to implement this FC. Currently when the Axis JavaToSoap FC serializes an RPC-style message it uses XML hrefs/multi-refs in the generated SOAP, and this breaks the Axis C++ library. That is why an Axis JavaToSoap FC configuration parameter is present to allow you to switch hrefs/multi-refs on and off.
Serialization is the process of converting a Java object to an XML element. Deserialization is the process of converting an XML element to a Java object.
Both AxisJavaToSoap and AxisSoapToJava Function Components provide methods for registering XML type to Java type mappings with custom serializers/deserializers (by default all complex types are serialized/deserialized by Axis' org.apache.axis.encoding.ser.BeanSerializer/org.apache.axis.encoding.ser.BeanDeserializer).
/** * This method is analogous to the 'registerTypeMapping' method in org.apache.axis.client.Call. * It can be used for configuring serialization/deserialization of Java types, for which the * default serializer/deserializer (org.apache.axis.encoding.ser.BeanSerializer/ * org.apache.axis.encoding.ser.BeanDeserializer) is not suitable. */ public void registerTypeMapping(Class javaType, QName xmlType, SerializerFactory serializerFactory, DeserializerFactory deserializerFactory)
This method can be invoked on an FC in the "After Initialize" Prolog FC hook through JavaScript™ like this:
var myClass = java.lang.Class.forName("mypackage.MyClass"); var myQName = new javax.xml.namespace.QName("http://www.myserver.com", "MyClass"); var mySerializerFactory = new mypackage.MySerializerFactory(); var myDeserializerFactory = new mypackage.MyDeserializerFactory(); myFC.getFunction().registerTypeMapping(myClass, myQName, mySerializerFactory, myDeserializerFactory);
By default all complex types are serialized/deserialized by Axis’ org.apache.axis.encoding.ser.BeanSerializer/org.apache.axis.encoding.ser.BeanDeserializer. These default serializers and deserializers are not appropriate in certain rare cases. If you face a serialization/deserialization error, it is likely that we need to provide a custom serializer/deserializer.
Here is one of the known cases:
<s:simpleType name="MyListType"> <s:list> <s:simpleType> <s:restriction base="s:string"> <s:enumeration value="One" /> <s:enumeration value="Two" /> <s:enumeration value="Three" /> </s:restriction> </s:simpleType> </s:list> </s:simpleType>... we will see an error like the following:
at org.apache.axis.encoding.ser.ArrayDeserializer.characters(ArrayDeserializer.java:502) at org.apache.axis.encoding.DeserializationContext.characters(DeserializationContext.java:966) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:177) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at org.apache.axis.client.Call.invoke(Call.java:2467) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.ibm.di.fc.webservice.AxisEasyInvokeSoapWS.perform(Unknown Source)The cause of the problem is that org.apache.axis.encoding.ser.ArrayDeserializer is not appropriate for xsd:list types. You should use the org.apache.axis.encoding.ser.SimpleListDeserializer deserializer instead. We can fix the problem using a script like the following in the After Initialize hook of the AxisJavaToSoap/AxisSoapToJava FC:
var javaType = java.lang.Class.forName("[Ljava.lang.String;"); var xmlType = new javax.xml.namespace.QName("http://www.example.com", "MyListType");; var serializerFactory = new org.apache.axis.encoding.ser.SimpleListSerializerFactory(javaType, xmlType); var deserializerFactory = new org.apache.axis.encoding.ser.SimpleListDeserializerFactory(javaType, xmlType); thisConnector.getFunction().registerTypeMapping(javaType, xmlType, serializerFactory, deserializerFactory);
Axis Soap To Java Function Component