org.jboss.soa.esb.actions.soap.wise
Class SOAPClient
java.lang.Object
org.jboss.soa.esb.actions.AbstractActionLifecycle
org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
org.jboss.soa.esb.actions.soap.wise.SOAPClient
- All Implemented Interfaces:
- ActionLifecycle, ActionPipelineProcessor
@Publish(value=WiseWsdlContractPublisher.class)
public class SOAPClient
- extends AbstractActionPipelineProcessor
SOAP Client action processor.
Uses the Wise Client Service to generate JAXWS client class and call the target service.
This action then routes that message to that service.
Endpoint Operation Specification
Specifying the endpoint operation is a straightforward task. Simply specify the "wsdl" and "SOAPAction" properties on the
SOAPClient action as follows:
<action name="soap-wise-client-action" class="org.jboss.soa.esb.actions.soap.wise.SOAPClient">
<property name="wsdl" value="http://localhost:8080/acme/services/OrderManagement?wsdl"/>
<property name="SOAPAction" value="http://www.acme.com/OrderManagement/SendSalesOrderNotification"/>
</action>
The SOAP operation is derived from the SOAPAction. There are some optional attribute:
<property name="EndPointName" value="PingWSPort"/>
The EndPoint invoked. Webservices can have multiple endpoint. If it's not specified the first specified in wsdl will be used
<property name="SmooksRequestMapper" value="smooks-request-config.xml"/>
It's a smooks config file to define the mapping java-to-java defined for the request
<property name="SmooksResponseMapper" value="smooks-response-config.xml"/>
It's a smooks config file to define the mapping java-to-java defined for the response
<property name="serviceName" value="PingWS"/>
It's a symbolic service name used by wise to cache object generation and/or use already generated object. It it isn't provided
wise use the servlet name of wsdl.
<property name="userName" value=""/>
<property name="password" value=""/>
User and password used if webservice is protected by BAsic Authentication HTTP user and password
SOAP Request Message Construction
The SOAP operation parameters are supplied in one of 2 ways:
- As a
Map
instance set on the default body location (Message.getBody().add(Map))
- As a
Map
instance set on in a named body location (Message.getBody().add(String, Map)), where the name of
that body location is specified as the value of the "paramsLocation" action property.
The parameter Map
itself can also be populated in one of 2 ways:
- Option 1: With a set of Objects of any type. In this case a smooks config have to be specified in action attribute
SmooksRequestMapper and smooks is used to make the java-to-java conversion
- Option 2: With a set of String based key-value pairs(<String, Object>), where the key is the name of the
SOAP parameter as specified in wsdls (or in generated class) to be populated with the key's value.
SOAP Response Message Consumption
The SOAP response object instance can be is attached to the ESB Message
instance in one of the following ways:
- On the default body location (Message.getBody().add(Map))
- On in a named body location (Message.getBody().add(String, Map)), where the name of that body location is
specified as the value of the "responseLocation" action property.
The response object instance can also be populated (from the SOAP response) in one of 3 ways:
- Option 1: With a set of Objects of any type. In this case a smooks config have to be specified in action attribute
SmooksResponseMapper and smooks is used to make the java-to-java conversion
- Option 2: With a set of String based key-value pairs(<String, Object>), where the key is the name of the
SOAP answer as specified in wsdls (or in generated class) to be populated with the key's value.
JAX-WS Handler for the SOAP Request/Response Message
It's often necessary to be able to transform the SOAP request or response, especially in header. This may be to simply add some
standard SOAP handlers. Wise support JAXWS Soap Handler, both custom or a predefined one based on smooks. Transformation
of the SOAP request (before sending) is supported by configuring the SOAPClient action with a Smooks transformation
configuration property as follows:
<property name="smooksTransform" value="/transforms/order-transform.xml" />
The value of the "smooksTransform" property is resolved by first checking it as a filesystem based resource. Failing that, it's
checked as a classpath resource and failing that, as a URI based resource.
It's also possible to provide a set of custom standard JAXWS Soap Handler. The parameter accept a list of classes implementing
SoapHandler interface. Classes have to provide full qualified name and be separated by semi-columns.
<property name="custom-handlers" value="package.Class1;package.Class2" />
Logging the SOAP Request/Response Message
It's useful for debug purpose to view soap Message sent and response received. Wise achieve this goal using a JAX-WS handler
printing all messages exchanged on System.out You can enable as follow:
<property name="LoggingMessages" value="true" />
- Author:
- stefano.maestri@javalinux.it
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SOAPClient
public SOAPClient(ConfigTree config)
throws ConfigurationException
- Throws:
ConfigurationException
process
public Message process(Message message)
throws ActionProcessingException
- Description copied from interface:
ActionPipelineProcessor
- Perform the action processing on the specified message.
This method is invoked for each message passing throught the pipeline.
- Parameters:
message
- The current message being processed.
- Returns:
- The message to be passed to the next stage of the pipeline.
- Throws:
ActionProcessingException
- for errors during processing.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object