atg.projects.b2bstore.soap
Class SimpleSOAPClient

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.projects.b2bstore.soap.SimpleSOAPClient
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class SimpleSOAPClient
extends GenericService

This service can be used to send a series of objects via a SOAP request. The method that should be used to send a request out via SOAP is the #invoke(Vector)invoke method.


Field Summary
static java.lang.String CLASS_VERSION
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
SimpleSOAPClient()
           
 
Method Summary
protected  void addParameters(atg.apache.soap.rpc.Call pCall, java.util.Vector pParameters)
          Add the supplied parameter list to the Call object.
protected  atg.apache.soap.rpc.Call getCallObject()
          This method returns a Call object.
 java.lang.String getEncodingStyleURI()
          The encoding style that should be set on the Call object.
 java.lang.String getMethodName()
          The method name that is set on the Call object.
 java.lang.String getSOAPActionURI()
          Used by the Call.invoke() method.
 java.lang.String getSOAPServerURL()
          The URL that this SOAP client should make a request to.
 java.lang.String getTargetObjectURI()
          The targetObjectURI that is set on the Call object.
 void invoke(java.util.Vector pParameters)
          This is the expected method that will be called to send a Vector of atg.apache.soap.Parameter objects via a SOAP request.
 boolean isCheckForFault()
          If this component is configured to look for faults in the Response object, then the processFaultsprocessFaults method will be invoked.
 boolean isCheckForReturnValue()
          If this component is configured to look for a response from the server in the Response object, then the processFaultsprocessReturnValue method will be invoked.
protected  void processFaults(atg.apache.soap.rpc.Response pResponse)
          This provides a simple implementation.
protected  void processResponse(atg.apache.soap.rpc.Response pResponse)
          This method processes the Response object from the invoke method on a call object.
 void processReturnValue(atg.apache.soap.rpc.Response pResponse)
          This method is just an adapter method.
 void setCheckForFault(boolean pCheckForFault)
          Set the checkForFault property.
 void setCheckForReturnValue(boolean pCheckForReturnValue)
          Set the checkForReturnValue property.
 void setEncodingStyleURI(java.lang.String pEncodingStyleURI)
          Set the encodingStyleURI property.
 void setMethodName(java.lang.String pMethodName)
          Set the methodName property.
 void setSOAPActionURI(java.lang.String pSOAPActionURI)
          Set the SOAPActionURI property.
 void setSOAPServerURL(java.lang.String pSOAPServerURL)
          Set the SOAPServerURL property.
 void setTargetObjectURI(java.lang.String pTargetObjectURI)
          Set the TargetObjectURI property.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

SimpleSOAPClient

public SimpleSOAPClient()
Method Detail

getSOAPServerURL

public java.lang.String getSOAPServerURL()
The URL that this SOAP client should make a request to. This is used as an argument to the Call.invoke() method. An example would be: http://localhost:8080/soap/servlet/rpcrouter

Returns:
the Server URL

setSOAPServerURL

public void setSOAPServerURL(java.lang.String pSOAPServerURL)
                      throws java.net.MalformedURLException
Set the SOAPServerURL property. When the SOAPServerURL is set, it will attempt to create a new URL object and assign this to a member variable. An error will be logged if a MalformedURLException is thrown.

Parameters:
pSOAPServerURL -
Throws:
java.net.MalformedURLException

getSOAPActionURI

public java.lang.String getSOAPActionURI()
Used by the Call.invoke() method.

Returns:
SOAPActionURI property

setSOAPActionURI

public void setSOAPActionURI(java.lang.String pSOAPActionURI)
Set the SOAPActionURI property.

Parameters:
pSOAPActionURI -

isCheckForFault

public boolean isCheckForFault()
If this component is configured to look for faults in the Response object, then the processFaultsprocessFaults method will be invoked.

Returns:
whether or not the Response object should be checked for faults

setCheckForFault

public void setCheckForFault(boolean pCheckForFault)
Set the checkForFault property.

Parameters:
pCheckForFault -

isCheckForReturnValue

public boolean isCheckForReturnValue()
If this component is configured to look for a response from the server in the Response object, then the processFaultsprocessReturnValue method will be invoked.

Returns:
whether or not the Response object should be checked for return values

setCheckForReturnValue

public void setCheckForReturnValue(boolean pCheckForReturnValue)
Set the checkForReturnValue property.

Parameters:
pCheckForReturnValue -

getTargetObjectURI

public java.lang.String getTargetObjectURI()
The targetObjectURI that is set on the Call object. This is what the SOAP server uses to route incoming request to a particular service.

Returns:
the targetObjectURI

setTargetObjectURI

public void setTargetObjectURI(java.lang.String pTargetObjectURI)
Set the TargetObjectURI property.

Parameters:
pTargetObjectURI -

getMethodName

public java.lang.String getMethodName()
The method name that is set on the Call object.

Returns:

setMethodName

public void setMethodName(java.lang.String pMethodName)
Set the methodName property.

Parameters:
pMethodName -

getEncodingStyleURI

public java.lang.String getEncodingStyleURI()
The encoding style that should be set on the Call object. This defaults to Constants.NS_URI_SOAP_ENC

Returns:
the encoding sytle

setEncodingStyleURI

public void setEncodingStyleURI(java.lang.String pEncodingStyleURI)
Set the encodingStyleURI property.

Parameters:
pEncodingStyleURI -

getCallObject

protected atg.apache.soap.rpc.Call getCallObject()
This method returns a Call object. This creates a new Call object and sets the following properties on it. this method can be overriden if the Call method needed to be constructed in a different manner.

Returns:
a Call object

processFaults

protected void processFaults(atg.apache.soap.rpc.Response pResponse)
This provides a simple implementation. It extracts the faultCode and faultString from the response object and writes it to the error log.

Parameters:
pResponse - the Response object returned from an invoke call.

processReturnValue

public void processReturnValue(atg.apache.soap.rpc.Response pResponse)
This method is just an adapter method. It does not do anything. If it is invoked, it will throw a UnsupportedOperationException.

Parameters:
the - response from the SOAP invocation

processResponse

protected void processResponse(atg.apache.soap.rpc.Response pResponse)
This method processes the Response object from the invoke method on a call object. It determines if the Response object should be checked for faults and/or returnValues. It does this via the isCheckForFault and isCheckForReturnValue methods respectively.

If either of the above items should be checked then it will call processFaults and/or processReturnValue

Parameters:
pResponse - a Response value

addParameters

protected void addParameters(atg.apache.soap.rpc.Call pCall,
                             java.util.Vector pParameters)
Add the supplied parameter list to the Call object. The contents of the pParameters list must be a list of atg.apache.soap.rpc.Parameter objects.

Parameters:
pCall - the call object that is used to invoke SOAP service
pParameters - list of vectors to pass as parameters to the Call object. This list must be a list of atg.apache.soap.rpc.Parameter objects.

invoke

public void invoke(java.util.Vector pParameters)
This is the expected method that will be called to send a Vector of atg.apache.soap.Parameter objects via a SOAP request.

It will create a call object by calling getCallObject and then add the parameters to the call object via the addParameters. Finally, it will cal invoke on the Call object and determine if any processing needs to be done on the Response object by calling processResponse

Parameters:
pParameters - the Object that contains parameters to be sent in the SOAP rpc call. This Vector must contain Paramter objects.