|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The custom binder is an interface to be implemented by the binding provider to deal with a particular pair of XML schema type and Java type. CustomBinder interface has two primary methods: serialize and deserialize; and both methods deal with a Java object and javax.xml.soap.SOAPElement. Once the binder is recognized by the engine runtime, it communicates with the runtime via the SOAPElement in the following ways: For serialization, the binder is invoked by the runtime and it receives a Java object and a SOAPElement. Java object is the data to be serialized, and SOAPElement is the context element for the serialization. Unlike the conventional serializer which writes out the raw data, the custom binder here is to produce an intermediate form of SOAP message: SOAPElement. The runtime takes care of writing the SOAPElement to the raw data. Obviously, it's easier to create the SOAPElement rather than the raw text since SAAJ APIs are available to help. Similarly for deserialization, the runtime builds an appropriate javax.xml.soap.SOAPElement instance and passes it to the binder which then deserializes it to a Java object.
Field Summary | |
---|---|
static java.lang.String |
QNAME_SCOPE_COMPLEXTYPE
|
static java.lang.String |
QNAME_SCOPE_ELEMENT
|
static java.lang.String |
QNAME_SCOPE_SIMPLETYPE
|
Method Summary | |
---|---|
java.lang.Object |
deserialize(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. |
SOAPElement |
serialize(java.lang.Object bean,
SOAPElement rootNode,
CustomBindingContext context)
Serialize the Java object to the SOAPElement |
Field Detail |
public static final java.lang.String QNAME_SCOPE_ELEMENT
public static final java.lang.String QNAME_SCOPE_COMPLEXTYPE
public static final java.lang.String QNAME_SCOPE_SIMPLETYPE
Method Detail |
public javax.xml.namespace.QName getQName()
public java.lang.String getQNameScope()
public java.lang.String getJavaName()
public SOAPElement serialize(java.lang.Object bean, SOAPElement rootNode, CustomBindingContext context) throws SOAPException
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.
SOAPException
- when
a) the "bean" object does not match the advertised java class name
b) the serialization fails.public java.lang.Object deserialize(SOAPElement source, CustomBindingContext context) throws SOAPException
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.
SOAPException
- when it fails to deserialize the passed SOAPElement to
appropriate object.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |