org.openspml.v2.transport
Class SPMLViaSoapDispatcher

java.lang.Object
  extended byorg.openspml.v2.transport.SPMLViaSoapDispatcher
All Implemented Interfaces:
RPCDispatcher

public class SPMLViaSoapDispatcher
extends java.lang.Object
implements RPCDispatcher

This is a demonstration class for handling SOAP.

Author:
kent.spaulding@sun.com

Date: Jan 20, 2006


Constructor Summary
SPMLViaSoapDispatcher()
           
 
Method Summary
 java.lang.String dispatchRequest(java.lang.String inMessage)
          This does the bulk of the work.
 java.lang.String getContentType()
          If you handle a request of a given type, you also need to provide us with contentType string to return.
 void init(RPCRouter router, java.util.Map config)
          We want to run over the config and instantiate our marshallers and excecutors.
protected  SPMLExecutor[] initExecutors(RPCRouter router, java.util.Map config)
          Set up the executors list from the config.
protected  SPMLMarshaller[] initMarshallers(RPCRouter router, java.util.Map config)
          Initialize the marshallers names in the config
protected  java.lang.String unwrapRequest(java.lang.String message)
          Pull out the Soap body
protected  java.lang.String wrapResponse(java.lang.String result)
          Add a soap envelope.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPMLViaSoapDispatcher

public SPMLViaSoapDispatcher()
Method Detail

init

public void init(RPCRouter router,
                 java.util.Map config)
          throws Spml2TransportException
We want to run over the config and instantiate our marshallers and excecutors.

Specified by:
init in interface RPCDispatcher
Parameters:
router -
config -
Throws:
Spml2TransportException

dispatchRequest

public java.lang.String dispatchRequest(java.lang.String inMessage)
                                 throws Spml2TransportException
This does the bulk of the work. Uses the marshallers to find a worthy request object; then finds an executor for the request. Returns the result after executing it.

Note that you might use different executors for sync and async.

Specified by:
dispatchRequest in interface RPCDispatcher
Parameters:
inMessage -
Returns:
xml represeting the response.
Throws:
Spml2TransportException

getContentType

public java.lang.String getContentType()
Description copied from interface: RPCDispatcher
If you handle a request of a given type, you also need to provide us with contentType string to return.

Specified by:
getContentType in interface RPCDispatcher
Returns:
String representing the type.

initMarshallers

protected SPMLMarshaller[] initMarshallers(RPCRouter router,
                                           java.util.Map config)
                                    throws Spml2TransportException
Initialize the marshallers names in the config

Parameters:
router -
config -
Returns:
the marhsallers that we instantiated from the config contents.
Throws:
Spml2TransportException

initExecutors

protected SPMLExecutor[] initExecutors(RPCRouter router,
                                       java.util.Map config)
                                throws Spml2TransportException
Set up the executors list from the config.

Parameters:
router -
config -
Returns:
the executors we instantiated from the config contents
Throws:
Spml2TransportException

unwrapRequest

protected java.lang.String unwrapRequest(java.lang.String message)
                                  throws Spml2Exception
Pull out the Soap body

Parameters:
message -
Returns:
message xml without the SOAP elements... just the body.
Throws:
Spml2Exception

wrapResponse

protected java.lang.String wrapResponse(java.lang.String result)
Add a soap envelope.

Parameters:
result -
Returns:
The result, wrapped in a SOAP Envelope.


Copyright © Sun Microsystems, Inc. All Rights Reserved.