Petals-BC-SOAP

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (71)

View Page History
{column}

h1. What is the BC-SOAP ?

This binding component allows to interact with external Web Services and to expose JBI services as Web Services.
This component is based on the Petals CDK.

_If you want more details about SOAP, you can consult this W3C specification : [http://www.w3.org/TR/soap/|http://www.w3.org/TR/soap/]._ :_ _[http://www.w3.org/TR/soap/|http://www.w3.org/TR/soap/]__._

h1. Features
* WS-Security, WS-SecureConversation and WS-Policy via the addition of the Rampart's Axis2 module.

{column}
{column:width=350px}
{panel:title=Table of contents}{toc}{panel}
{panel:title=Contributors}{contributors:order=name|mode=list}{panel}
{column}
{section}

h1. Component Configuration

<jbi:description> The SOAP Binding Component (based on Axis2 + Jetty)</jbi:description>
</jbi:identification>

<jbi:component-class-name>org.ow2.petals.binding.soap.SoapComponent</jbi:component-class-name>
<jbi:component-class-path>...</jbi:component-class-path>
<jbi:bootstrap-class-name>org.ow2.petals.binding.soap.SoapBootstrap</jbi:bootstrap-class-name>
<jbi:bootstrap-class-path>...</jbi:bootstrap-class-path>

<!-- Component Development Kit Parameters -->
<petalsCDK:acceptor-pool-size>5</petalsCDK:acceptor-pool-size>
org.ow2.petals.binding.soap.listener.incoming.SoapExternalListener
</petalsCDK:externallistener-class-name>

<!-- SOAP Component Parameters -->
<soap:http-port>8084</soap:http-port>
| http-port | The port used by the Jetty HTTP server to handle incoming http requests | 8084 | No |
| http-host | Define the network interface on which the web servser must listen. If this parameter is not set, all interfaces are listen. | localhost | No |
| http-services-list | Display the list of exposed services on http://<HOST>:<PORT>/\\
<CONTEXT>/<MAPPING>/listServices | true | No |
| http-threadpool-size-min | Minimun size of the Jetty HTTP server thread pool | 2 | No |
| http-threadpool-size-max | Maximun size of the Jetty HTTP server thread pool | 50 | No |
service-name="sample:SoapInterface"
endpoint-name="SoapInterfaceEndpoint">

<!-- CDK specific fields -->
<petalsCDK:wsdl>http://example.org/service/SampleWebService?wsdl</petalsCDK:wsdl>

<!-- SOAP specific fields -->
<soap:address>http://example.org/service/SampleWebService</soap:address>
{center}
{table-plus}

|| Parameter || Description || Default || Required ||
| address | Address of the external Web Service to send JBI messages to. | \- | Yes |
| mode | The mode to be used to send SOAP message to the specified address. \\ Possible values are : {{SOAP}} for basic WebService calls, {{TOPIC}} for
Possible values are : {{SOAP}} for basic WebService calls, {{TOPIC}} for\\
WebService notifications and {{REST}} for REST service calls. | \- | Yes |
| soap-version | The SOAP version used to create SOAP messages. \\ \\
| soap-version | The SOAP version used to create SOAP messages. \\ \\ Possible values are {{11}} and {{12}}. | SOAP | No |
| synchronous-timeout | The timeout value when invoking a a service in the JBI bus. \\{info:title=Note}This value override the CDK value.{info} \\ \\ The value is expressed in milliseconds. | 2000 | No |
| synchronous-timeout | The timeout value when invoking a a service in the JBI bus. \\ {info:title=Note}This value override the CDK value.{info} \\ \\
The value is expressed in milliseconds. | 2000 | No |
| proxy-host | The proxy host name. \\ \\
| proxy-host | The proxy host name. \\ \\ If it is not set, the proxy mode will be disabled and all others proxy parameters are ignored. | \- | No |
| proxy-port | The proxy host port. | \- | No |
| proxy-user | The proxy user. | \- | No |
| proxy-password | The proxy password. | \- | No |
| proxy-domain | The proxy domain. | \- | No |
| cleanup-transport | Cleanup the transport after the WebService call. \\ \\ Not cleaning up the transport can cause timeouts on large number of calls. \\ \\ Possible values are: {{true}}, {{false}}. | true | No |
| cleanup-transport | Cleanup the transport after the WebService call. \\ \\
Not cleaning up the transport can cause timeouts on large number of calls. \\ \\
Possible values are: {{true}}, {{false}}. | true | No |
| headers-filter | A value used to filter Normalized Message properties to be added to the outgoing SOAP message. All the normalized message properties which are {{org.w3c.dom.DocumentFragment}} instances. These values can be filtered at the Service Unit level with the headers-filter property. If the headers-filter property is set to '{{org.ow2.petals.soap.foo.\*, org.ow2.petals.soap.bar}}', all the DocumentFragment properties which are starting with '{{org.ow2.petals.soap.foo.\*}}' and with '{{org.ow2.petals.soap.bar}}' will be added to the outgoing SOAP Header (as children). | \- | No |
| inject-headers | Inject some additional headers to the outgoing SOAP message. All the elements of the {{org.w3c.dom.DocumentFragment}} Map which is available in the {{javax.jbi.messaging.protocol.headers}} message properties will be added if the Service Unit level property inject-headers is set to true. | false | No |
{table-plus}
*Configuration of a Service Unit to provide a service (SOAP)*
h2. Send a JBI message from an incoming SOAP message

The petals-bc-soap component can listen incoming SOAP messages and send messages to a JBI ServiceEndpoint. We say that the component consumes the JBI service :

{center}

\\
The component is configured to handle URIs with the {{[http://HOST:PORT/petals/services/ADDRESS]}} pattern. It also handles ?wsdl calls; the wsdl description is retrieved from the endpoint and sent back to the consumer.

\\

\\
The list of services is available at {{[http://HOST:PORT/petals/services/listServices]}} URI.

h3. Service Unit descriptor
service-name="sample:ConsumedService"
endpoint-name="ConsumedEndpoint">

<!-- CDK specific fields -->
<petalsCDK:operation>operation</petalsCDK:operation>
<petalsCDK:mep>InOut</petalsCDK:mep>

<!-- SOAP specific fields -->
<soap:address>ExposedService</soap:address>
<soap:remove-root>false</soap:remove-root>
<soap:mode>SOAP</soap:mode>

<!-- optional modules -->
<soap:modules>addressing, rampart</soap:modules>
{center}
{table-plus}

|| Parameter || Description || Default || Required ||
| address | The name of the Axis2 Web Service that will be created on Service Unit deployment. \\ \\ This service is created and linked to the JBI context. \\ \\ Each SOAP/REST message received on this service will be forwarded to the JBI endpoint specified in the consumes element. \\ \\ The WebService will be accessible at {{http://<HOST>:<PORT>/
| address | The name of the Axis2 Web Service that will be created on Service Unit deployment. \\ \\
This service is created and linked to the JBI context. \\ \\
Each SOAP/REST message received on this service will be forwarded to the JBI endpoint specified in the consumes element. \\ \\
The WebService will be accessible at {{http://<HOST>:<PORT>/\\
<CONTEXT>/<MAPPING>/<address>}}. | \- | Yes |
| synchronous-timeout | todo | 2000 | No |
| modules | todo | \- | No |
| service-parameters | Additional XML configuration section as CDATA for created Axis2 service. | \- | No |
| remove-root | Remove the root element of the payload. \\ \\
| remove-root | Remove the root element of the payload. \\ \\ Possible values are : {{true}}, {{false}}. | {{false}} | No |
| mode | The mode to be used to send SOAP message to the specified address. \\ \\ Possible values are : \\
Possible values are :
* {{SOAP}} for basic WebService calls
* {{TOPIC}} for WebService notifications
h3. Provide mode : Provide access to external REST Service

In order to activate REST mode, the Service Unit (in provide mode) must be configured like this :

{code:lang=xml}
xmlns:soap="http://petals.ow2.org/components/soap/version-3.1"
xmlns:sample="http://petals.ow2.org/soap/sample">

<!-- Import a Service into PEtALS or Expose a PEtALS Service => use a BC. -->
<jbi:services binding-component="true">
service-name="sample:SoapInterface"
endpoint-name="SoapInterfaceEndpoint">

<!-- CDK specific fields -->
<petalsCDK:mep xsi:nil="true"/>

<!-- WSDL file -->
<petalsCDK:wsdl>
http://example.org/service/SampleWebService?wsdl
</petalsCDK:wsdl>

<!-- SOAP specific fields -->
<soap:address>
<jbi:consumes interface-name="helloworld:Helloworld" service-name="helloworld:HelloworldService"
endpoint-name="HelloworldEndpoint">

<!-- CDK specific fields -->
<petalsCDK:mep>InOut</petalsCDK:mep>
<petalsCDK:operation>getXXX</petalsCDK:operation>

<!-- SOAP specific fields -->
<soap:address>RESTServiceName</soap:address>
<!-- Import a Service into PEtALS or Expose a PEtALS Service => use a BC. -->
<jbi:services binding-component="true">

<!-- Import a Service into PEtALS => provides a Service. -->
<jbi:provides
service-name="sample:YahooWeatherService"
endpoint-name="YahooWeatherEndpoint">

<!-- CDK specific fields -->
<petalsCDK:mep xsi:nil="true"/>

<!-- WSDL file -->
<petalsCDK:wsdl>Weather.wsdl</petalsCDK:wsdl>

<!-- SOAP specific fields -->
<soap:address>
{noformat}

and produces the URI {{[http://weather.yahooapis.com/forecastrss?p=FRXX0099&u=c]}}.

\\
service-name="sample:SampleProviderService"
endpoint-name="SampleProvider">

<!-- CDK specific fields -->
<petalsCDK:mep>InOut</petalsCDK:mep>
<petalsCDK:operation>${input_operation}</petalsCDK:operation>

<!-- SOAP specific fields -->
<soap:address>RESTService</soap:address>
{code}

With the {{rest.add-namespace-\*}} parameters specified in the previous configuration, the JBI message will be like :
{code:lang=xml}
<ns1:myOperation xmlns:ns1="http://petals.ow2.org/sample">
Let's suppose that the JBI service returns a JBI response like :
{code:lang=xml}
<ns1:Response xmlns:ns1="http://petals.ow2.org/sample1"
xmlns:ns2="http://petals.ow2.org/sample2"
xmlns:ns3="http://petals.ow2.org/sample3">
If the {{rest.remove-prefix-on-response}} parameter is set to 'ns1,ns2', the message returned to the REST service consumer will be :
{code:lang=xml}
<Response xmlns:ns1="http://petals.ow2.org/sample1"
xmlns:ns2="http://petals.ow2.org/sample2"
xmlns:ns3="http://petals.ow2.org/sample3">
If the {{rest.remove-prefix-on-response}} parameter is set to '*', the message returned to the REST service consumer will be :
{code:lang=xml}
<Response xmlns:ns1="http://petals.ow2.org/sample1"
xmlns:ns2="http://petals.ow2.org/sample2"
xmlns:ns3="http://petals.ow2.org/sample3">
service-name="sample:TopicService"
endpoint-name="TopicEndpoint">

<!-- SOAP specific fields -->
<soap:address>TopicSample</soap:address>
In order to receive WS-Notifications, the consumers MUST subscribe to these notifications to the WS-N producer.

To subscribe to WS notification, the notification consumer must send a specific SOAP message to the notification producer. In the SOAP BC, subscription URL is {{[http://HOST:PORT/wsn/producer]}} where :
* HOST is the host you have installed the SOAP BC
* PORT is the port where the SOAP BC listens to incoming SOAP messages
public static void main(String[] args) {
EndpointReference sourceEPR = new EndpointReference(URI.create("http://localhost:9090/wsn-consumer/"));
EndpointReference destinationEPR =
new EndpointReference(URI.create("http://localhost:9090/wsn-consumer/service/consumer"));
WsnProducerClient client = new WsnProducerClient(sourceEPR,
h2. Send a WS notification from a JBI message

When the petals-bc-soap component receives a JBI message on a topic-activated endpoint, it is transformed into a WS-notification message and published on the linked topic.

As an example of SOAP notification message, if the JBI message payload is :
The SOAP binding component provides WS security features through the Axis2 rampart module ([http://ws.apache.org/rampart/|http://ws.apache.org/rampart/]).

This module is based on Apache WSS4J ([http://ws.apache.org/wss4j/|http://ws.apache.org/wss4j/]), an implementation of the OASIS WS-security specification ([http://www.oasis-open.org/committees/wss|http://www.oasis-open.org/committees/wss]).

This module is natively provided by the binding component since the 3.0 release.
<jbi:consumes interface-name="helloworld:Helloworld" service-name="helloworld:HelloworldService"
endpoint-name="HelloworldEndpoint">

<!-- CDK specific fields -->
<petalsCDK:mep>InOut</petalsCDK:mep>

<!-- SOAP specific fields -->
<soap:address>UserPasswordSecuredService</soap:address>
The following code snippet shows how to engage the rampaet module on the client side and how to call the Web Service :
{code}
ConfigurationContext ctx =
ConfigurationContextFactory
.createConfigurationContextFromFileSystem(axis2ConfPath, null);
xmlns:soap="http://petals.ow2.org/components/soap/version-3.1"
xmlns:sample="http://petals.ow2.org/soap/sample">

<!-- Import a Service into PEtALS or Expose a PEtALS Service => use a BC. -->
<jbi:services binding-component="true">
<!-- Import a Service into PEtALS => provides a Service. -->
service-name="sample:PolicyService"
endpoint-name="PolicyEndpoint">

<!-- CDK specific fields -->
<petalsCDK:mep xsi:nil="true"/>

<!-- WSDL file -->
<petalsCDK:wsdl>sample02.wsdl.wsdl</petalsCDK:wsdl>

<!-- SOAP specific fields -->
<soap:address>http://localhost:8888/axis2/services/PolicyService</soap:address>
<sp:InitiatorToken>
<wsp:Policy>
<sp:X509Token
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/
IncludeToken/AlwaysToRecipient">
<sp:RecipientToken>
<wsp:Policy>
<sp:X509Token
sp:IncludeToken=
"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">

If the exception message "Transport out has not been set" occurs when invoking an external web-service, using the petals-bc-soap, it can be due to a wrong URL of the external web-service. Please check it and retry your test.
{column}
{column:width=350px}
{panel:title=Table of contents}{toc}{panel}
{panel:title=Contributors}{contributors:order=name|mode=list}{panel}
{column}
{section}