Petals-BC-SOAP 5.0.0+

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

Changes (22)

View Page History
h3. 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 descriptor for the Petals' "petals-bc-soap" component (SOAP).
Originally created for the version 4.1 of the component.
-->
<jbi:jbi version="1.0"
xmlns:generatedNs="http://petals.ow2.org/"
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:IntegrationService"
endpoint-name="IntegrationServiceSOAP">

<!-- CDK specific elements -->
<petalsCDK:timeout>60000</petalsCDK:timeout>
<petalsCDK:mep xsi:nil="true" />

<!-- Component specific elements -->
<soap:address>IntegrationServiceSOAPByPetalsUsernameToken</soap:address>
<soap:remove-root>false</soap:remove-root>
<soap:enable-http-transport>true</soap:enable-http-transport>
<soap:modules>rampart</soap:modules>
<soap:service-parameters> <soap:wss-policy>wss-policy.xml</soap:wss-policy>
<![CDATA[
<parameter name="InflowSecurity">
<action>
<items>UsernameToken</items>
<passwordCallbackClass>org.ow2.petals.test.PWCBHandler</passwordCallbackClass>
</action>
</parameter>
]]>
</soap:service-parameters>
</jbi:consumes>
</jbi:services>
{code}

with the WS-Policy defined as following into the file {{wss-policy.xml}}:
{code:lang=xml}
<wsp:Policy wsu:Id="UTOverTransport"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:SignedSupportingTokens
xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
<wsp:Policy>
<sp:UsernameToken
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:HashPassword />
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SignedSupportingTokens>

<ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
<ramp:passwordCallbackClass>org.ow2.petals.test.PWCBHandler</ramp:passwordCallbackClass>
</ramp:RampartConfig>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
{code}

h3. Service Unit content

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

h1. Exposing an internal JBI service endpoint as a Web Service with WS-Security (Timestamp, Signature and Encryption)

h2. Configuration
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<!--
JBI descriptor for the Petals' "petals-bc-soap" component (SOAP).
Originally created for the version 4.1 of the component.
-->
<jbi:jbi version="1.0"
xmlns:generatedNs="http://petals.ow2.org/"
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:IntegrationService"
endpoint-name="IntegrationServiceSOAP">

<!-- CDK specific elements -->
<petalsCDK:timeout>60000</petalsCDK:timeout>
<petalsCDK:mep xsi:nil="true" />

<!-- Component specific elements -->
<soap:address>IntegrationServiceSOAPByPetalsChiffrementSignature</soap:address>
<soap:remove-root>false</soap:remove-root>
{code}

with the WS-Policy defined as following into the file {{wss-policy.xml}}:
{code:lang=xml}
<wsp:Policy wsu:Id="SigEncr"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:ProtectionToken>
<wsp:Policy>
<sp:X509Token
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
<wsp:Policy>
<!-- sp:RequireDerivedKeys />
<sp:RequireIssuerSerialReference />
<sp:RequireThumbprintReference />
<sp:WssX509V3Token10 /-->

<ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
<ramp:userCertAlias>signKey</ramp:userCertAlias>
<ramp:encryptionUser>encryptKey</ramp:encryptionUser>
</ramp:RampartConfig>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:ProtectionToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128 />
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Strict />
</wsp:Policy>
</sp:Layout>
<sp:EncryptBeforeSigning />
<sp:OnlySignEntireHeadersAndBody />
</wsp:Policy>
</sp:SymmetricBinding>
<sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<sp:Body />
</sp:SignedParts>
<sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<sp:Body />
</sp:EncryptedParts>

<ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
<ramp:userCertAlias>signKey</ramp:userCertAlias-->
<ramp:encryptionUser>encryptKey</ramp:encryptionUser>
<ramp:passwordCallbackClass>org.ow2.petals.test.PWCBHandler</ramp:passwordCallbackClass>

<ramp:signatureCrypto>
<ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
<ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
<ramp:property name="org.apache.ws.security.crypto.merlin.file">serverKeystore.jks</ramp:property>
<!-- Password of the keystore -->
<ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">serverKeystorePassword</ramp:property>
</ramp:crypto>
</ramp:signatureCrypto>
<ramp:encryptionCypto>
<ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
<ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
<ramp:property name="org.apache.ws.security.crypto.merlin.file">serverKeystore.jks</ramp:property>
<!-- Password of the keystore -->
<ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">serverKeystorePassword</ramp:property>
</ramp:crypto>
</ramp:encryptionCypto>
</ramp:RampartConfig>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
{code}

h3. Service Unit content

The Service Unit has to contain the following elements, packaged in an archive:
* The META-INF/jbi.xml descriptor file as described above
* the service.properties properties file (quoted in the jbi.xml)
{code}
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=serverKeystorePassword
org.apache.ws.security.crypto.merlin.file=serverKeystore.jks
{code}
* the serverKeystore.jks keystore file (quoted in the service.properties)
* the pcwbhandler.jar containing org.ow2.petals.test.PWCBHandler (quoted in the jbi.xml - necessary to get the private key pair from the keystore to decrypt the incoming message and to get the public/private key pair to sign the outcoming message)
* 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 in the WS-Policy - 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)


h1. Provide a Web Service access in the ESB with WS-Security (Timestamp, Signature and Encryption)