Friday, November 20, 2009

How to write a BPEL extension for WSO2 BPS 1.1.0 and Apache ODE

You may always wanted to write your own BPEL activity to handle your scenario. This article will go through step by step process to implement a simple BPEL extension activity for WSO2 BPS and Apache ODE.
WSO2 Business Process Server (BPS) is an easy-to-use open source business process server that executes business processes written using the WS-BPEL standard. It is powered by Apache ODE (open source BPEL engine) and provides a complete Web-based graphical console to deploy, manage and view processes in addition to managing and viewing process instances.

Implementation of Extension Bundle

Create a class by implementing one of the ExtensionOperation interfaces which are available at [1]. The run* method of this class should contain the implementation of the extension activity. You can find a sample implementation of this class at [2].
Then You have to create a class by implementing AbstractExtensionBundle interface. Within this class, the above implemented ExtensionOperation class should be registered. A sample implementation can be found at [3].

Configure WSO2 BPS

There are two methods to expose the extension classes to BPS.
  • Creating a jar.

    Copy the jar to BPS_HOME/repository/components/lib directory.
  • Creating an OSGI bundle

    Copy the bundle to BPS_HOME/repository/components/dropins directory.
Add the following configuration entry to the bps.xml file in BPS_HOME/conf directory. Repalce org.wso2.bps.samples.extension by your extension class name.
Note: By default, the sample extension bundles shipped with WSO2 BPS are copied to BPS_HOME/repository/components/lib. You have to add the following configuration to get them registered in BPS.
<bps xmlns="">
Now, restart WSO2 BPS sever, and you are ready to use the new extension in your BPEL.

The process is almost the same for Apache ODE. But there is a separate configuration file to register the extension. Please refer ODE extensions documentation for more details.

Using the Extension activity in your BPEL

The extension must be declared before, it is used.

<bpel:extension namespace="#extension-namespace#" 

If the mustUnderstand attribute is set to yes, then the extension should be registered in BPS server in order to deploy the BPEL process. Otherwise, it will throws an error at the compilation stage of the process. If the mustUnderstand attribute is set to no, then the BPEL process will be deployed without checking whether there is an extension registered in the server.

Using the activity. According to the sample anyElementQName should be equal to b4ptest
<anyElementQName standard-attributes>
You can find a sample BPEL process at


[1] - extension


  1. Hi
    can you provide the zip file (link is dead) for a fully example, I am having trouble calling my extension?


  2. Hi Gary,
    Can you try now. I fixed the link.


  3. Hi,
    I try to setup your given example(,and my runtime environment consist of eclipse , apache ode 1.3.5 ,tomcat.

    And I put B4PExtensionBundle.jar to /WEB-INF/lib and Registered the extension in /WEB-INF/conf/ and add the following lines
    ode-axis2.extension.bundles.runtime = org.wso2.bps.samples.extension.B4PExtensionBundle

    Unfortunately, the BPEL process can be executed successfully but the jar seem not be invoked.

    Could you give me some suggestion?


    1. Hi, BPEL extensions are only supported in Apache ODE 2.x branch. But ODE 2.x is no longer maintained. Therefore you can try WSO2 BPS which is also based on Apache ODE but with extension support.