atg.projects.b2bstore.soap
Class SendObjectAsXML

java.lang.Object
  extended by atg.process.action.ActionImpl
      extended by atg.projects.b2bstore.soap.SendObjectAsXML
All Implemented Interfaces:
Action

public class SendObjectAsXML
extends ActionImpl

This action is used to send objects out via a SOAP RPC call. In order to do this, two thing must happen. First, a supplied Object parameter must be marshalled to XML. This marshalling is done by a configured ObjectMarshallerDispatcher service. After the object has been converted to an XML document, the document must be sent out via a SOAP request. This is done by a SimpleSOAPClient. To understand how these various methods are invoked, consult the #executeAction(ProcessExecutionContext)executeAction() method. This action requires a single parameter: marshalObject.

See Also:
atg.xml.service.ObjectMarshallerDispatcher, ActionImpl, SimpleSOAPClient

Field Summary
static java.lang.String CLASS_VERSION
           
 
Constructor Summary
SendObjectAsXML()
           
 
Method Summary
 void configure(java.lang.Object pConfiguration)
          Configures the action using the given configuration object, of type SendObjectAsXMLConfiguration.
protected  atg.apache.soap.rpc.Parameter createParameter(org.w3c.dom.Element pObjectAsXML)
          Create the Parameter that will be used to invoke the SOAP client.
protected  void executeAction(ProcessExecutionContext pContext)
          This method peforms the work for the action.
 atg.xml.service.marshal.ObjectMarshallerDispatcher getMarshalService()
          This service is used to marshal the supplied object parameter into an XML document.
protected  org.w3c.dom.Element getObjectAsXML(java.lang.Object pObjectToMarshal, java.lang.Object pKey)
          This method will obtain the XML representation of the supplied object.
 SimpleSOAPClient getSimpleSOAPClient()
          This is the SOAP client that will be used to send the XML document out via a SOAP call.
protected  java.lang.String getSOAPParameterName()
          Return the value of SOAPConstants.SOAP_PARAMETER_NAME This defaults to xmlDocument
 void initialize(java.util.Map pParameters)
          The initialize method is used to initialize this Scenario action before first time use.
 void setMarshalService(atg.xml.service.marshal.ObjectMarshallerDispatcher pMarshalService)
          Set the MarshalService property.
 void setSimpleSOAPClient(SimpleSOAPClient pSimpleSOAPClient)
          Set the SimpleSOAPClient property.
 
Methods inherited from class atg.process.action.ActionImpl
execute, execute, getActionName, getParameterExpression, getParameterValue, storeOptionalParameter, storeRequiredMutableParameter, storeRequiredParameter, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

SendObjectAsXML

public SendObjectAsXML()
Method Detail

getMarshalService

public atg.xml.service.marshal.ObjectMarshallerDispatcher getMarshalService()
This service is used to marshal the supplied object parameter into an XML document. This property gets set from the passed in SendObjectAsXMLConfiguration object in the #initialize(Map)configure() method.

Returns:
the ObjectMarshallerDispatcher that will be used to marshal object.

setMarshalService

public void setMarshalService(atg.xml.service.marshal.ObjectMarshallerDispatcher pMarshalService)
Set the MarshalService property. This is the service used to marshal object to XML.

Parameters:
pMarshalService - the service marshal the object

getSimpleSOAPClient

public SimpleSOAPClient getSimpleSOAPClient()
This is the SOAP client that will be used to send the XML document out via a SOAP call. This property gets set from the passed in SendObjectAsXMLConfiguration object in the #initialize(Map)configure() method.

Returns:
the SimpleSOAPClient

setSimpleSOAPClient

public void setSimpleSOAPClient(SimpleSOAPClient pSimpleSOAPClient)
Set the SimpleSOAPClient property. This gets set in the configure method.

Parameters:
pSimpleSOAPClient - the simple SOAP client to use to send messages

configure

public void configure(java.lang.Object pConfiguration)
               throws ProcessException
Configures the action using the given configuration object, of type SendObjectAsXMLConfiguration. This sets up the following properties of this class, by copying them out of the configuration object:

Specified by:
configure in interface Action
Overrides:
configure in class ActionImpl
Throws:
ProcessException - if the action could not be configured - for example, because some of the required properties are missing from the configuration

initialize

public void initialize(java.util.Map pParameters)
                throws ProcessException
The initialize method is used to initialize this Scenario action before first time use. It sets up several properties of this class:

Specified by:
initialize in interface Action
Overrides:
initialize in class ActionImpl
Parameters:
pParameters - map of parameters that were handed to this scenario
Throws:
ProcessException - if an error occurs
See Also:
Expression

executeAction

protected void executeAction(ProcessExecutionContext pContext)
                      throws ProcessException
This method peforms the work for the action. It will call several methods contained in this class to do the work. First, it will get the XML representation of the object. It will do this by obtaining the marshal object as well as the marshal key parameter and call the #getObjectAsXML(Object, Object)getObjectAsXML. Once it has the XML representation, it will create a SOAP parameter object by calling the createParameter method. Finally, it will send the XML document out via a SOAP request by calling the invoke method on the class.

Specified by:
executeAction in class ActionImpl
Parameters:
pContext - a ProcessExecutionContext value
Throws:
ProcessException - if an error occurs

getSOAPParameterName

protected java.lang.String getSOAPParameterName()
Return the value of SOAPConstants.SOAP_PARAMETER_NAME This defaults to xmlDocument

Returns:
the name to use to identify the xml document parameter

createParameter

protected atg.apache.soap.rpc.Parameter createParameter(org.w3c.dom.Element pObjectAsXML)
Create the Parameter that will be used to invoke the SOAP client. This Parameter is an instance of the atg.apache.soap.rpc.Parameter class. The name used for the parameter is obtained via the #getSOAPParameterNamegetSOAPParameterName method.

Parameters:
pObjectAsXML - the XML element that will be sent via the SOAP request.
Returns:
the Parameter object to invoke the SOAP client with.

getObjectAsXML

protected org.w3c.dom.Element getObjectAsXML(java.lang.Object pObjectToMarshal,
                                             java.lang.Object pKey)
                                      throws ProcessException
This method will obtain the XML representation of the supplied object. This is done by querying the configured ObjectMarshallerDispatcher to marshal the object. To see how the ObjectMarshallerDispatcher service gets configured, consult the initialize method.

Parameters:
pObjectToMarshal - the object that will be marshalled to XML
pKey - the key that will be passed to the ObjectMarshallerDispatcher service
Returns:
the XML representation of the object.
Throws:
ProcessException