Petals-BC-SOAP 5.1.0+

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

Changes (42)

View Page History
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
|| Parameter || Description || Default || Required ||
| service-name | Web-service name to expose. This value appears on URL used to expose the service. | \- | Yes |
| soap-action | The SOAP action QName to be used for the Web Service, will override the JBI message operation. | \- | No |
| mode | The mode to be used to receive messages. Possible values are: SOAP for basic Web Service messages, JSON for JSON service messages and REST for REST service messages. | SOAP | Yes |
h2. As a web-service SOAP over JMS

By configuring the SOAP component and a Service Unit, it is possible to consume an internal JBI service.
The Petals BC SOAP can receive JMS messages from a JMS queue and send SOAP messages (contained in the JMS body message) to a JBI service endpoint by deploying a service unit on it. It enables to support the following scenario: a JMS publisher sends a message to a JMS server and the SOAP component consumes the JMS message which contains a SOAP envelope in its body.

When the service unit is started, a queue is created on the JMS server by the SOAP component if it does not exist. The name of the queue is the value of the parameter "{{service-name}}". When a message is sent to the JMS queue, it is received and treated by the SOAP component.

{note:title=JMS server}
The JMS server must be started before starting the BC SOAP component (if the JMS transport layer is configured).
{note}

{note:title=JMS driver as shared library}
A shared library corresponding to the JMS server must be installed in Petals ESB before installing the BC SOAP component.
{note}

{warning:title=Warning}
This feature is currently only supported in consumer mode with the operation with the MEP InOnly.
{warning}

h3. Usage

The petals-bc-soap component can receive JMS messages from a JMS queue and send SOAP messages (contained in the JMS body message) to a JBI service endpoint by deploying a Service Unit on it. The component consumes the JBI service.

It enables to support the following scenario: A JMS publisher sends a message to a JMS server and the SOAP component consumes the JMS message which contains a SOAP envelope in its body:

{center}
!petals-bc-soap-x.x-soap_over_jms.png|border=1,width=500,height=285!
*Consumes a JBI service on JMS message (containing SOAP envelope)*
{center}

The service-name Service Unit extension value will be used as Axis2 service name.

When a JMS message is handled by the component, the SOAP envelope (in its body) is extracted by Axis, is transformed into a JBI Message and sent to the JBI service endpoint configured in the Service Unit. The JBI message is created like this:
* The JBI operation is created from the SOAP action.
* Copy the SOAP body into the JBI one.
* Put the SOAP attachments into JBI ones.
* Put the SOAP headers into the protocol header JBI message property.

h3. Configuration

h3. Configuration

All needed information must be defined in the service-unit JBI descriptor. This JBI descriptor is configured through parameters divided in following groups:
* *JBI parameters* that defines the service provider identification,
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
|| Parameter || Description || Default || Required ||
| service-name | Web Service name to expose. | \- | Yes |
| service-name | Web-service name to expose, used as JMS destination to listen. | \- | Yes |
| soap-action | The SOAP action QName to be used for the Web Service, will override the JBI message operation. | \- | No |
| mode | The mode to be used to receive messages. Possible values are: SOAP for basic Web Service messages, JSON for JSON service messages and REST for REST service messages. | SOAP | Yes |
{code}

h2. As a Web Service with WS-Security

We Security is enabled engagong the module '{{rampart}}' and providing a WS Policy file through parameters '{{modules}}' and '{{wss-policy}}'.

h3. Configuration

h4. JMS server
Moreover the basic configuration to expose the internal endpoint as a HTTP(S)/SOAP or JMS/SOAP service, the following parameters exist to drive WS-Security:

A JMS server must be started before starting the BC SOAP component (if the JMS transport layer is configured). The compatible JMS servers are Joram and Apache ActiveMQ.
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
|| Parameter || Description || Default || Required ||
| modules | A list of Axis2 modules names to engage (separated by comas). Only Rampart (with value '{{rampart}}') can be engaged to enable WS-Security | \- | No |
| wss-policy | The file describing the WS Policy to apply. | \- | No |
wss-policy
{table-plus}

h4. Shared library
h3. Example of WS-Security based on UsernameToken

A shared library corresponding to the JMS server (SL-JMS-Joram or SL-JMS-ActimeMQ) must be installed in Petals ESB before installing the BC SOAP component in Petals ESB.
h4. Service unit descriptor

h4. Component descriptor

The JMS transport layer must be set in the component jbi.xml file (cf [SOAP component configuration|#componentConfiguration]):
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0" xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:soap="http://petals.ow2.org/components/soap/version-4">
<jbi:component type="binding-component"
bootstrap-class-loader-delegation="parent-first">
<jbi:identification>
<jbi:name>petals-bc-soap</jbi:name>
<jbi:description>The SOAP Binding Component (based on Axis2 + Jetty)</jbi:description>
</jbi:identification>
...

<!-- SOAP Component Parameters -->
...
<!-- JMS transport layer -->
<soap:java-naming-factory-initial>org.apache.activemq.jndi.ActiveMQInitialContextFactory</soap:java-naming-factory-initial>
<soap:java-naming-provider-url>tcp://localhost:61616</soap:java-naming-provider-url>
<soap:jms-connection-factory-jndiname>QueueConnectionFactory</soap:jms-connection-factory-jndiname>
</jbi:component>
</jbi:jbi>
{code}

h4. Service Unit descriptor

The JMS transport must be enabled in the Service Unit jbi.xml file:
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
    xmlns:generatedNs="http://petals.ow2.org/"
    xmlns:jbi="http://java.sun.com/xml/ns/jbi"
    xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
    xmlns:soap="http://petals.ow2.org/components/soap/version-4"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    
    <!-- Import a Service into Petals or Expose a Petals Service => use a BC. -->
    <jbi:services binding-component="true">
    
        <!-- Expose a Petals Service => consumes a Service. -->
        <jbi:consumes
            interface-name="generatedNs:JMSService"
            service-name="generatedNs:JMSService"
            endpoint-name="JMSServiceSOAP">
    
...            
<soap:enable-jms-transport>true</soap:enable-jms-transport>
        </jbi:consumes>
    </jbi:services>
</jbi:jbi>
{code}

When the SU is started, a queue is created on the JMS server by the SOAP component if it does not exist. The name of the queue is the value of the parameter soap:address or soap:service-name.

When a message is sent to the JMS queue, it is received and treated by the SOAP component.

h2. As a Web Service with WS-Security (UsernameToken)

h3. Configuration

h4. Service Unit descriptor

An example of a Service Unit descriptor that consumes a Web Service with a WS-Plicy based on UsernameToken:
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
xmlns:generatedNs="http://petals.ow2.org/"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:soap="http://petals.ow2.org/components/soap/version-54"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

{code}

h4. Service Uunit content

The Service Unit service unit has to contain the following elements, packaged in an the archive:
* Tthe META-INF/jbi.xml descriptor file as described above,
* the WS-Policy file described as above,
* and the pcwbhandler.jar containing org.ow2.petals.test.PWCBHandler (quoted in the WS-Policy file - necessary to check the user and the password of the token)
* and a JAR file containing a password callback, quoted in the WS-Policy file and necessary to check the user and the password of the token

h2. As a Web Service with WS-Security (Signature and Encryption)
{code}
service-unit.zip
+ META-INF
- jbi.xml (as defined above)
- wss-policy.xml (The WS Policy description)
- pcwbhandler.jar (The password callback)
{code}

h3. Configuration
h3. Example of WS-Security based on Timestamp, Signature and Encryption

h4. Service Uunit descriptor

An example of a Service Unit descriptor that consumes a Web Service with Timestamp, Signature and Encryption:
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
{code}

h4. Service Uunit content

The Service Unit service unit has to contain the following elements, packaged in an the archive:
* Tthe META-INF/jbi.xml descriptor file as described above,
* the WS-Policy file described as above,
* the serverKeystore.jks keystore file (quoted in the WS-Policy) containing keys for encryption and signature
* a JAR file containing org.ow2.petals.test.PWCBHandler (quoted a password callback, quoted in the WS-Policy - file and necessary to get the private key pair from the keystore to encrypt/decrypt the incoming and outgoing messages and to get the public/private key pair to sign the messages),
* the serverKeystore.jks keystore file, quoted in the WS-Policy and containing keys for encryption and signature.

{code}
service-unit.zip
+ META-INF
- jbi.xml (as defined above)
- wss-policy.xml (The WS Policy description)
- pcwbhandler.jar (The password callback)
- serverKeystore.jks (The key store)
{code}

{anchor:componentConfiguration}
h1. Configuring the component
{table-plus}

h3. Example of component configuration

{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0" xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:soap="http://petals.ow2.org/components/soap/version-4">
<jbi:component type="binding-component"
bootstrap-class-loader-delegation="parent-first">
...

<!-- HTTPS support -->
<soap:http-port>8080</soap:http-port>

<!-- HTTPS support -->
<soap:https-enabled>true</soap:https-enabled>
<soap:https-port>8081</soap:https-port>
<soap:https-keystore-type>JKS</soap:https-keystore-type>
<soap:https-keystore-file>../https/serverKeystore.jks</soap:https-keystore-file>
<soap:https-keystore-password>passwordServerKeystore</soap:https-keystore-password>
<soap:https-key-password>petalsServerK</soap:https-key-password>
<soap:https-truststore-type>JKS</soap:https-truststore-type>
<soap:https-truststore-file>../https/serverTruststore.jks</soap:https-truststore-file>
<soap:https-truststore-password>passwordServerTruststore</soap:https-truststore-password>

<!-- JMS transport layer -->
<soap:java-naming-factory-initial>org.apache.activemq.jndi.ActiveMQInitialContextFactory</soap:java-naming-factory-initial>
<soap:java-naming-provider-url>tcp://localhost:61616</soap:java-naming-provider-url>
<soap:jms-connection-factory-jndiname>QueueConnectionFactory</soap:jms-connection-factory-jndiname>
</jbi:component>
</jbi:jbi>
{code}

h1. Business monitoring