.
Once the binder is recognized by the engine runtime, it communicates with the runtime via the
SOAPElement in the following ways:
Serialization:
- The binder is invoked by the runtime and the
serialize
method is passed a Java object and
SOAPElement root.
- The Java object is the data to be serialized
- The root SOAPElement is an empty IBMSOAPElement.
- The binder implementation should add child elements and other content to
the root IBMSOAPElement that represents the data of the Java object.
- Use the
IBMSOAPElement.getIBMSOAPFactory()
method to obtain a factory
for producing the child elements.
- Also note that the SAAJ interfaces are not thread-safe. You should not use SOAPElements that
are accessible by multiple threads.
- The binder should return the root IBMSOAPElement.
- The runtime will write out the returned SOAPElement to the raw xml data.
Deserialization:
- The binder
deserialize
method is invoked by the runtime with an
IBMSOAPElement
representing
the xml data.
- The binder implementation is responsibile for building a Java object representing
the data.
- The runtime will use the Java object as the data for the operation target.
Method Summary |
java.lang.Object |
deserialize(javax.xml.soap.SOAPElement source,
CustomBindingContext context)
Deserialize the SOAPElement to the Java object. |
java.lang.String |
getJavaName()
Return the class name of the java type to be handled by this CustomBinder |
javax.xml.namespace.QName |
getQName()
Return the QName of the target XML schema type. |
java.lang.String |
getQNameScope()
Return the qname scope of the target XML schema type. |
javax.xml.soap.SOAPElement |
serialize(java.lang.Object bean,
javax.xml.soap.SOAPElement rootNode,
CustomBindingContext context)
Serialize the Java object to the SOAPElement. |
QNAME_SCOPE_ELEMENT
static final java.lang.String QNAME_SCOPE_ELEMENT
- See Also:
- Constant Field Values
QNAME_SCOPE_COMPLEXTYPE
static final java.lang.String QNAME_SCOPE_COMPLEXTYPE
- See Also:
- Constant Field Values
QNAME_SCOPE_SIMPLETYPE
static final java.lang.String QNAME_SCOPE_SIMPLETYPE
- See Also:
- Constant Field Values
getQName
javax.xml.namespace.QName getQName()
- Return the QName of the target XML schema type.
getQNameScope
java.lang.String getQNameScope()
- Return the qname scope of the target XML schema type. Its value
is either simpleType, complexType, or element.
getJavaName
java.lang.String getJavaName()
- Return the class name of the java type to be handled by this CustomBinder
serialize
javax.xml.soap.SOAPElement serialize(java.lang.Object bean,
javax.xml.soap.SOAPElement rootNode,
CustomBindingContext context)
throws javax.xml.soap.SOAPException
- Serialize the Java object to the SOAPElement.
- Parameters:
bean
- A Java object to be serialized by the custom binder.
The type for this Java object has to be compatiable with what's returned by
getJavaName()
.
If getJavaName()
returns a name for a concrete class, the class for this "bean"
object should be either the exact class or the derived class. If getJavaName()
returna a name for a Java interface, the class for this "bean" has to implement
this interface.
rootNode
- A SOAPElement
representing the root node upon which the custom binder operates.
This SOAPElement
is created by the runtime with the QName matching the
QName of the "element" element defined in the schema and it does not have any child elements.context
- An object representing the binding context.
- Returns:
- a
SOAPElement
representing the serialized XML data.
- Throws:
javax.xml.soap.SOAPException
- when:
- the "bean" object does not match the advertised java class name
- the serialization fails.
- See Also:
CustomBinder
deserialize
java.lang.Object deserialize(javax.xml.soap.SOAPElement source,
CustomBindingContext context)
throws javax.xml.soap.SOAPException
- Deserialize the
SOAPElement
to the Java object.
- Parameters:
source
- a SOAPElement
representing the XML message from the wire. It has all necessary
namespace declarations, including those inherited from the parent element.context
- An object representing the binding context.
- Returns:
- a Java object which is deserialized from the source
SOAPElement
. Its type has to be
compatible with what's returned by the getJavaName()
method.
- Throws:
javax.xml.soap.SOAPException
- when it fails to deserialize the passed SOAPElement
to
the appropriate object.- See Also:
CustomBinder