Monday, March 5, 2012

Unified endpoints for BPEL Processes

WSO2 Carbon platform supports unified-endpoints(UEPs) to configure partner endpoints which are used in the BPEL processes. In more general terms, UEPs facilitate for a generalized way of configuring endpoints taking quality of service in to the picture. So a particular UEP configuration can be used across the carbon platform to configure security in a partner endpoint in BPEL process and to configure WS-Addressing in a WSO2 ESB endpoint.

This post provides a guide on how to properly configure a partner endpoint in a BPEL process.
Tested Environment :
  • WSO2 Carbon 4.0.0 based releases 

Please take a look at Async-Server sample which is a sample BPEL process which uses an UEP to configure the target endpoint of a partner service.

<wsa:EndpointReference
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com uep_schema.xsd"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsdl11="http://schemas.xmlsoap.org/wsdl/">
<wsa:Address>http://localhost:9973/services/ServerCallbackService</wsa:Address>
<wsa:Metadata>
<id>SInvokeEPR</id>
</wsa:Metadata>
</wsa:EndpointReference>
view raw gistfile1.xml hosted with ❤ by GitHub

If you are interested in other supported constructs by UEPs, please refer this xml schema which provides the current supported functionality like setting “ReplyTo” header.

So where is this UEP configuration actually engaged to a partner endpoint?. This is configured at the deploy.xml which declares the particular partner service as follows. Please refer the same sample mentioned above.

<?xml version="1.0" encoding="UTF-8"?>
<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03" xmlns:client="urn:ode-apache-org:example:async:client"
xmlns:server="urn:ode-apache-org:example:async:server">
<process name="server:Server">
<active>true</active>
<retired>false</retired>
<process-events generate="all" />
<provide partnerLink="client">
<service name="server:ServerService" port="ServerPort" />
</provide>
<invoke partnerLink="client">
<service name="client:ServerCallbackService" port="ServerCallbackPort">
<endpoint xmlns="http://wso2.org/bps/bpel/endpoint/config"
endpointReference="uep.epr"/>
</service>
</invoke>
</process>
</deploy>
view raw gistfile1.xml hosted with ❤ by GitHub

If you look at the mentioned sample above, UEP configuration is located inside with the BPEL artifact.
But on the other hand, an UEP can be maintained outside from the BPEL artifact. So it can be located in the file system or registry. Maintaining an UEP outside from the BPEL artifact becomes very useful when governing endpoints which are used by multiple BPEL processes in multiple WSO2 BPS instances.

eg - If the UEP to be maintained in the file sytem - Use the absolute path for the UEP in deploy.xml

<endpoint xmlns="http://wso2.org/bps/bpel/endpoint/config"
endpointReference="/opt/wso2/server/config/uep.epr"/>
view raw gistfile1.xml hosted with ❤ by GitHub

eg - If the UEP to be maintained in the registry - Use the registry specific path for the UEP in deploy.xml

<endpoint xmlns="http://wso2.org/bps/bpel/endpoint/config"
endpointReference="conf:/uep.epr"/>
view raw gistfile1.xml hosted with ❤ by GitHub

Please refer this UEP on configuring security for a partner service via a UEP. More information on this can be found from this post as well.