Swordfish Documentation: Executing BPEL
Executing BPEL Processes
The execution of BPEL processes in Swordfish is based on a deployment of BPEL into the Apache ODE BPEL engine. The deployment uses Servicemix 4 as a JBI container and an adapted ODE JBI integration layer which supports an EclipseLink based database integration to persist the process state.
Related Reading Material
- For information on installing the ODE engine, see Installing ODE engine.
- For information on the Swordfish-ODE integration, see ODE User Guide
- For general information about the ODE JBI deployment you can try out some of the tutorials here: ODE Tutorials
- BPEL processes suitable for Apache ODE can be created using the Eclipse BPEL Designer
- Swordfish provids some patches which enables its installation in Galileo. For more information, see Installing BPEL Designer in Gallileo
Deploying a BPEL Process
In Swordfish, BPEL processes are deployed as JBI Service Assembly. ODE User Guide Section 3) describes how such a BPEL Service Assembly can be created from these required artifacts:
- BPEL process file
- compiled BPEL file
- imported WSDL files
- a deployment descriptor deploy.xml
Swordfish ODE is currently based on ODE version 2.0, you may find process samples in the examples folder of the ODE 2.0 JBI binary distribution, the samples contain ANT scripts which build the BPEL process service assemblies.
By default ODE process samples are in the form of a JBI component package zip file which can be deployed by copying them into the deploy folder of the Servicemix 4 working directory specified using the -Dservicemix.base option inside the VM arguments section of the Eclipse Run Configuration used to start Swordfish.
Here is an example for a META-INF/jbi.xml file describing a simple hello world process JBI service assembly:
<jbi version="1.0" xmlns="http://java.sun.com/xml/ns/jbi"> <service-assembly> <identification> <name>HelloWorld-SA</name> <description>HelloWorld Service Assembly</description> </identification> <service-unit> <identification> <name>HelloWorld-HTTP</name> <description>HelloWorld HTTP Binding</description> </identification> <target> <artifacts-zip>HelloWorld-HTTP.zip</artifacts-zip> <component-name>servicemix-http</component-name> </target> </service-unit> <service-unit> <identification> <name>HelloWorld-process</name> <description>HelloWorld BPEL Service Unit</description> </identification> <target> <artifacts-zip>HelloWorld-Process.zip</artifacts-zip> <component-name>OdeBpelEngine</component-name> </target> </service-unit> </service-assembly> </jbi>
Here is an example of the ODE deployment descriptor deploy.xml
<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03" xmlns:pns="urn:/HeaderTest.bpel" xmlns:sns="urn:/HelloWorld.wsdl" > <process name="pns:HelloWorld"> <active>true</active> <provide partnerLink="helloPartnerLink"> <service name="sns:HelloService" port="HelloPort"/> </provide> </process> </deploy>
Alternatively, if you want some processes to be installed automatically during the start of Swordfish, you may repackage the process service assemblies as OSGI bundles and install/start them using OSGI mechanisms - either using the install/start commands of the OSGI console or list the process bundles inside the Equinox config.ini file.
To repackage the process service assemblies as OSGI bundles:
- Change the file extension from zip to jar
- Change the component archive:
- open archive for editing (or unpack it somewhere) and go to METAINF folder, you should see the jbi.xml file here.
- Add a MANIFEST.MF file in this folder with the following content:
- Repackage the archive and you are ready to install the bundle.
- Run swordfish and install bundle manually with osgi> install file:///your-bundle-location.
- Start the bundle with the command osgi> start BUNDLE_ID (you can check bundle ID with osgi> ss command).
- Alternatively, you can add a bundle statement to \org.eclipse.swordfish.bundles\config.ini file to automatically install and start the process during the Swordfish startup.
Manifest-Version: 1.0 Bundle-SymbolicName: !!!!YOUR BUNDLE NAME!!!!! Bundle-Version: 0.0.0 DynamicImport-Package: javax.*,org.xml.*,org.w3c.*,org.apache.geronimo .transaction.manager.*
NOTE: You must add two empty lines at the end of the MANIFEST.MF file
The BPEL process itself - and its imported WSDLs - contain no physical endpoint definition, this is currently defined in a separate JBI service unit, for instance in a HTTP-binding component, which is deployed as part of the process service assembly. The process can then be called as a Web service according to the endpoint defined as part of the WSDL of this http-binding.
Here is an example of the endpoint definition of the HTTP-binding:
<service name="HelloService"> <port name="HelloPort" binding="tns:HelloSoapBinding"> <soap:address location="http://localhost:8080/hello-doc"/> <!-- Connect this external HTTP endpoint to the process internal JBI endpoint defined in HelloWorld2-process/HelloWorld2.dd --> <smix:endpoint role="consumer" defaultMep="in-out"/> </port> </service>
The Ant scripts of the process samples in the examples folder of the ODE 2.0 JBI binary distribution contain a test target which can be used to test the deployed process. Alternatively, any other web service testing environment can be used.
In future, Swordfish will support alternative process deployment scenarios where the endpoint resolution can be completed at run-time using a dynamic service resolving the interceptor plug-in.
JAX_WS-BPEL Integration Example
BPEL and Java can be viewed as different service implementation languages which can be integrated using Web Services. Swordfish provides a simple JAX_WS-BPEL integration example scenario covering both scenarios:
- calling a BPEL process from JAX-WS (BPEL as service provider)
- calling a JAX-WS service from BPEL (BPEL as service consumer)
This sample - including its creation using the Eclipse Designer - is described in Practical Process Orchestration using Eclipse SOA
The sample realizes the same flight reservation functionality as our standard Swordfish JAX-WS sample, but uses a reservation storage, which is implemented as a separate JAX-WS web service.
We realize the createReservation function as BPEL process calling a JAX-WS implemented reservationStorage.
So the java createReservation implemetation calls an ODE web service implementing this function. The BPEL process constructs a reservation from the input data and then calls a reservationStorage.put web service function.