Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Swordfish Documentation: Executing BPEL"

(New page: =Executing BPEL Processes=)
 
(Executing BPEL Processes)
Line 1: Line 1:
 
=Executing BPEL Processes=
 
=Executing BPEL Processes=
 +
Execution of [http://en.wikipedia.org/wiki/Business_Process_Execution_Language BPEL] processes in Swordfish is based on a deployment of BPEL into the
 +
[http://ode.apache.org Apache ODE] BPEL engine. The deployment uses
 +
[http://servicemix.apache.org/SMX4/index.html Servicemix 4]
 +
as JBI container
 +
and an adapted ODE JBI integration layer which supports an [http://www.eclipse.org/eclipselink/ EclipseLink] based database integration to persist the process state. See
 +
[[Swordfish_Documentation:_Installing_ODE_Engine| Installing ODE engine]] for additional information
 +
about the Swordfish-ODE integration, [http://ode.apache.org/user-guide.html#UserGuide-InJBI ODE User Guide]
 +
for general issues about the ODE JBI deployment and [http://ode.apache.org/links.html ODE Tutorials] for
 +
additional ODE tutorials.
 +
 +
BPEL processes suitable for [http://ode.apache.org Apache ODE] should be created using the [http://www.eclipse.org/bpel Eclipse BPEL Designer], Swordfish provided some patches which enables its installation
 +
in Galileo - see [[Swordfish_Documentation:_Installing_BPEL_Designer_in_Galileo| Installing BPEL Designer in Gallileo]]
 +
 +
==Deploying a BPEL Process==
 +
 +
In Swordfish BPEL processes are deployed as JBI Service Assembly. [http://ode.apache.org/user-guide.html#UserGuide-InJBI ODE User Guide] Section 3) describes how such a BPEL
 +
Service Assembly can be created out of the required artifacts - the BPEL process file, the compiled BPEL file (optional), imported WSDL files and a deployment descriptor [http://ode.apache.org/creating-a-process.html deploy.xml]. Swordfish ODE is currently based on ODE version 2.0, you may find process samples in the <tt>examples</tt> folder of the [http://www.apache.org/dyn/closer.cgi/ode/apache-ode-jbi-2.0-beta2.zip 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 <tt>deploy</tt> folder of the Servicemix 4 working directory specified
 +
using the <tt>-Dservicemix.base</tt> option inside the VM arguments section of the Eclipse Run Configuration
 +
used to start Swordfish.
 +
 +
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 <tt>install/start</tt> commands of the OSGI console or list the process bundles
 +
inside the Equinox <tt>config.ini</tt> file. 
 +
 +
Here follows a short description how process service assemblies can be repackaged as OSGI bundles:
 +
 +
* Change the file extension from <tt>zip</tt> to <tt>jar</tt>
 +
* 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:
 +
<pre>
 +
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.*
 +
</pre>
 +
* repack 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.
 +
 +
IMPORTANT: Add 2 empty lines at the end of the MANIFEST.MF file
 +
 +
Here is an example for a <tt>META-INF/jbi.xml</tt> file describing a simple hello world process JBI service assembly:
 +
 +
<pre>
 +
<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>
 +
</pre>
 +
 +
It follows a sample of the ODE deployment descriptor <tt>deploy.xml</tt>
 +
 +
<pre>
 +
<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>
 +
</pre>
 +
 +
==Execution==
 +
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 a http-binding component,
 +
which is deployed as part of the process service assembly. According to the endpoint defined as part of the
 +
WSDL of this http-binding the process can be called as a Web Service.
 +
 +
Sample of the endpoint definition of the http-binding:
 +
<pre>
 +
    <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>
 +
</pre>
 +
 +
The ant scripts of the process samples in the <tt>examples</tt> folder of the [http://www.apache.org/dyn/closer.cgi/ode/apache-ode-jbi-2.0-beta2.zip ODE 2.0 JBI binary distribution] contain a <tt>test</tt>
 +
target which can be used to test the deployed process. Alternatively any other web service testing environment
 +
can be used.
 +
 +
In the future Swordfish will support alternative process deployment scenarios where endpoint resolution is done
 +
at run time using a dynamic service resolving interceptor plugin.
 +
 +
==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 [http://www.eclipse.org/swordfish/assets/EC2009_BPEL.pdf 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 |Swordfish Documentation Home]] <br/>
 +
[[Swordfish | Swordfish Wiki Home]] <br/>

Revision as of 11:25, 9 June 2009

Executing BPEL Processes

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 JBI container and an adapted ODE JBI integration layer which supports an EclipseLink based database integration to persist the process state. See Installing ODE engine for additional information about the Swordfish-ODE integration, ODE User Guide for general issues about the ODE JBI deployment and ODE Tutorials for additional ODE tutorials.

BPEL processes suitable for Apache ODE should be created using the Eclipse BPEL Designer, Swordfish provided some patches which enables its installation in Galileo - 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 out of the required artifacts - the BPEL process file, the compiled BPEL file (optional), imported WSDL files and 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.

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.

Here follows a short description how process service assemblies can be repackaged 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:
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.*
  • repack 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.

IMPORTANT: Add 2 empty lines at the end of the MANIFEST.MF file

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>

It follows a sample 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>

Execution

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 a http-binding component, which is deployed as part of the process service assembly. According to the endpoint defined as part of the WSDL of this http-binding the process can be called as a Web Service.

Sample 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 the future Swordfish will support alternative process deployment scenarios where endpoint resolution is done at run time using a dynamic service resolving interceptor plugin.

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

Back to the top