Jump to: navigation, search

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

  1. For information on installing the ODE engine, see Installing ODE engine.
  2. For information on the Swordfish-ODE integration, see ODE User Guide
  3. For general information about the ODE JBI deployment you can try out some of the tutorials here: ODE Tutorials
  4. BPEL processes suitable for Apache ODE can be created using the Eclipse BPEL Designer
  5. 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:

  1. BPEL process file
  2. compiled BPEL file
  3. imported WSDL files
  4. 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>


Alternative Deployment

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:

  1. Change the file extension from zip to jar
  2. Change the component archive:
  3. open archive for editing (or unpack it somewhere) and go to METAINF folder, you should see the jbi.xml file here.
  4. Add a MANIFEST.MF file in this folder with the following content:
  5. 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.*
    
  6. Repackage the archive and you are ready to install the bundle.
  7. Run swordfish and install bundle manually with osgi> install file:///your-bundle-location.
  8. Start the bundle with the command osgi> start BUNDLE_ID (you can check bundle ID with osgi> ss command).
  9. 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.

NOTE: You must add two empty lines at the end of the MANIFEST.MF file

Endpoint Definition

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.


Swordfish Documentation Home
Swordfish Wiki Home