org.osesb.connectors.jaxrpc.test
Class CopySOAPElementToDOMElementTestClientHandler
java.lang.Object
javax.xml.rpc.handler.GenericHandler
org.osesb.connectors.jaxrpc.JAXRPCHandlerBase
org.osesb.connectors.jaxrpc.test.CopySOAPElementToDOMElementTestClientHandler
- All Implemented Interfaces:
- javax.xml.rpc.handler.Handler
public class CopySOAPElementToDOMElementTestClientHandler
- extends JAXRPCHandlerBase
The purpose of is client handler is to test the org.osesb.utilities.soap.SOAPUtilities
method, copySOAPElementToDOMElement(), which recursively copies the contents of a SOAPElement
to a DOM Element.
Any end point can be configured.
The test JAXRPCClientConfiguration is configured for ws-addressing and a JAXRPCClientAddressingHandler
is configured for the client-side handler chain in order to add ws-addressing entries to
the SOAPHeader.
The test programmatically adds CopySOAPElementToDOMElementTestClientHandler to the client-side
handler chain. CopyDOMElementToSOAPElementTestClientHandler expects a init param, 'soapElementName'
with the name of the SOAPElement to copy to the target DOM Element. For this test, the SOAPElement
can be any of the ws-addressing tags added to the SOAPHeader by the JAXRPCClientAddressingHandler.
The wsdl location of the end point is configured as an entry in the XMLRepository
and the end point, if invoked, does not need to understand the ws-addressing entries
in the SOAPHeader.
CopySOAPElementToDOMElementTestClientHandler logs the modified DOM Element to debug for
visual verification.
|
Method Summary |
boolean |
handleRequest(javax.xml.rpc.handler.MessageContext mc)
The handleRequest method processes the request message. |
static void |
main(java.lang.String[] args)
Main method for testing. |
| Methods inherited from class org.osesb.connectors.jaxrpc.JAXRPCHandlerBase |
enabled, getBooleanInitializationParameter, getDebugFlag, getHeaders, getInitializationParameter, getIntegerInitializationParameter, getLongInitializationParameter, getName, getStringInitializationParameter, handleException, handleResponse, init, requestEnabled, responseEnabled |
| Methods inherited from class javax.xml.rpc.handler.GenericHandler |
destroy, handleFault |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CopySOAPElementToDOMElementTestClientHandler
public CopySOAPElementToDOMElementTestClientHandler()
handleRequest
public boolean handleRequest(javax.xml.rpc.handler.MessageContext mc)
throws javax.xml.rpc.JAXRPCException
- Description copied from class:
JAXRPCHandlerBase
- The handleRequest method processes the request message. Ancestors override
this method, but should call super() to load the configured instance of SOAPUtilities.
Note that the method throws JAXRPCException and SOAPFaultException exceptions.
JAXRPCException is thrown from the core jax-rpc APIs to indicate an exception related
to the jax-rpc runtime mechanisms and SOAPFaultException is thrown to indicate
a SOAP fault at the service end-point.
The jax-rpc client API documentation states that jac-rpc handlers should throw
a JAXRPCException, not a SOAPFaultException. However, not all SOAP clients honor the spec.
However, jax-rpc clients, like JAXRPCDynamicSendMessageClient, should be able to distinguish
between exceptions thrown by the service end-point and exceptions thrown by the SOAP client engine.
Therefore, descendants should call handleException() to generate exceptions in a consistent
way that the jax-rpc client can depend on.
- Specified by:
handleRequest in interface javax.xml.rpc.handler.Handler- Overrides:
handleRequest in class JAXRPCHandlerBase
- Parameters:
mc - The MessageContext, which provides access to the SOAP message that carries
the RPC request that is processed by this handler.
- Returns:
- Return true to indicate continued processing of the request handler chain.
The handler-chain takes the responsibility of invoking the next entity.
The next entity may be the next handler in the handler-chain or if this handler
is the last handler in the chain, the next entity is the service endpoint object.
Return false to indicate blocking of the request handler chain. In this case,
further processing of the request handler chain is blocked and the target service
endpoint is not dispatched. The jax-rpc runtime system takes the responsibility
of invoking the response handler chain next with the SOAPMessageContext. The Handler
implementation class has the responsibility of setting the appropriate response
SOAP message in either handleRequest and/or handleResponse method. In the default
processing model, the response handler chain starts processing from the same Handler
instance (that returned false) and goes backward in the execution sequence.
- Throws:
javax.xml.rpc.JAXRPCException - indicates a handler-specific
runtime error. If JAXRPCException is thrown
by a handleRequest method, the HandlerChain
terminates the further processing of this handler
chain. On the server side, the HandlerChain
generates a SOAP fault that indicates that the
message could not be processed for reasons not
directly attributable to the contents of the
message itself but rather to a runtime error
during the processing of the message. On the
client side, the exception is propagated to
the client code
main
public static void main(java.lang.String[] args)
- Main method for testing.
- Parameters:
args - The test data directory.