org.jibx.ws.io.handler
Class UnmarshallingInHandler

java.lang.Object
  extended by org.jibx.ws.io.handler.UnmarshallingInHandler
All Implemented Interfaces:
InHandler

public class UnmarshallingInHandler
extends Object
implements InHandler

Unmarshalls the payload and makes it available through a subsequent call to getPayload(). Since this handler is stateful, it is only appropriate for client code, and is not supported for server side handling.


Constructor Summary
UnmarshallingInHandler(Class clazz)
          Create the unmarshaller using the binding factory for the "target class".
UnmarshallingInHandler(IBindingFactory factory)
          Create the unmarshaller using the specified binding factory.
UnmarshallingInHandler(String bindingName, String packageName)
          Create the unmarshaller using the binding factory for the specified binding name and binding package name.
 
Method Summary
 Object getPayload()
          Returns the payload that was unmarshalled in the previous call to invoke(InContext, IXMLReader).
 Object invoke(InContext context, IXMLReader xmlReader)
          Invokes the handler.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnmarshallingInHandler

public UnmarshallingInHandler(Class clazz)
                       throws WsBindingException
Create the unmarshaller using the binding factory for the "target class". This method can only be used with target classes that are mapped in only one binding. Note that there is no restriction on the "payload class" being the same as the target class. The only restriction is that the binding factory for the target class must include a binding for the payload class.

Parameters:
clazz - the target class
Throws:
WsBindingException - on any error in finding or accessing factory, or creating unmarshaller

UnmarshallingInHandler

public UnmarshallingInHandler(String bindingName,
                              String packageName)
                       throws WsBindingException
Create the unmarshaller using the binding factory for the specified binding name and binding package name. See BindingDirectory.getFactory(String, String) for further definition of the required binding name and binding package name.

Parameters:
bindingName - binding name
packageName - target package for binding
Throws:
WsBindingException - on any error in finding or accessing factory, or creating unmarshaller

UnmarshallingInHandler

public UnmarshallingInHandler(IBindingFactory factory)
                       throws WsBindingException
Create the unmarshaller using the specified binding factory.

Parameters:
factory - the binding factory
Throws:
WsBindingException - on any error in creating unmarshaller
Method Detail

invoke

public Object invoke(InContext context,
                     IXMLReader xmlReader)
              throws IOException,
                     WsException
Invokes the handler. If the handler processes the current element it needs to parse past the end tag of that element before returning.

Specified by:
invoke in interface InHandler
Parameters:
context - the context of the current message being received
xmlReader - a reader for the XML message positioned at the start of the XML content for which the handler is configured
Returns:
the object the handler has read from the XML content, or null if the handler has not processed the XML content
Throws:
IOException - on I/O error reading the XML content
WsException - on errors other than I/O errors

getPayload

public Object getPayload()
Returns the payload that was unmarshalled in the previous call to invoke(InContext, IXMLReader).

Returns:
payload


Project Web Site