Sunday, March 6, 2011

Some thoughts about the BPEL 2.0 Oracle SOA Suite 11g from PACKT publishing edition

Hi everyone,
To sum up, the book is pretty well designed.
The ideas of synchronous and asynchronous processes are used, and I really like this approach (this is the one I always use in BPEL and WS trainings).

The entire first part is dedicated to the BPEL language basic concepts.
The next part is more focused on the JDeveloper aspect, and more generally, how to develop with the Oracle tool some BPEL processes (Composite applications).
Then we are going back to some advanced BPEL extention concepts.
After that, there are lots of parts about Oracle SOA suite tools (which I almost never use, apart Oracle BAM).

1. First part
There is a good explaination and lots of details about the BPEL language (2.0 oriented).
Correlations, which is one of the hardest part of BPEL to understand is well explained also.

However, there is not even a word about Custom XPath Function which I really like.
Then I'm a bit disappointed regarding this last point since Custom XPath are really really a good thing.

2. Second part
About JDeveloper, so a bit boaring... but necessary when developping.
Anyway, this is a mandatory part.

Good thing : He talks about Testing SOA composite applications (how to test BPEL process) ! Very good.

3. Third part
Toh ! This guy is talking about Java Embedded ! I cannot believe it.
This is the most awful thing I've ever seen on BPEL ! (and this is only an Oracle BPEL extension).
He should have talked about Custom Xpath (which is equivalent in term of JTA transaction propagation).

He gives an good overview about the Fault Policy Management framework(also called Error Hospital by Oracle employees).
But I think a Java Action example should have been written...

Not even a word about the replay fault, which can be used outside of the Fault Policy Management...
See one of my previous blog post about this. So, a bit disappointed also.

4. Last parts about Oracle SOA tools
I'm not confortable enought with all those products to say anything about those parts.
And to be honest, I did not read those parts.

To conclude, I would say this book is alright if you don't know BPEL already, and if you want to dive inside the BPEL world (starting from BPEL 2.0).
Unfortunatly, there are some key points which are missing (from my point of view).

The other solution is to come to send me an email, and buy a Zenika BPEL training (available on Oracle BPEL and Apache ODE) :)
I travel all around the world for BPEL and ESB trainings, so don't be shimed.

Take care.

Tuesday, February 1, 2011

Oracle SOA Suite 11g book review

I'm currently doing a review for Packt Publishing.

WS-BPEL 2.0 for SOA Composite Applications with Oracle SOA Suite 11g

I'll let you know guys about this book soon.

Thursday, January 20, 2011

Tuesday, November 2, 2010

ActiveMQ - Les wilcards

I've discovered today an interesting new functionality on ActiveMQ.
This is the "Wildcards"

From a consumer point of view, it's possible thanks to some special characters to consume messages from several destinations (queues and topics) with only one consumer.

ActiveMQ cuts the destination's name in elements. Those elements are delimited by a dot (.).
For example, the below destinations have 3 elements :

- queue.france.rennes

Here are the special characters:
- . used to separate elements
- * used to match one element
- > used to match one or all trailing elements

For example, to consume all message for France, we can use the below consumer

String brokerURI = ActiveMQConnectionFactory.DEFAULT_BROKER_URL;
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerURI);
Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue france = session.createQueue("*.france.*");
MessageConsumer consumer = session.createConsumer(france);
Message message = consumer.receive();


Queue france = session.createQueue("*.france.>");

Conversely, the messages producer can send one message to several destinations (then we talk about broadcast). This is n messages, stricly identicaly sent to n destinations.
This avoids to create multiple producers for doing the same sending.

We talk about composite destinations.

Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue compositeDestination = session.createQueue("queue.france.rennes,");
MessageProducer producer = session.createProducer(compositeDestination);
Message message = session.createStreamMessage() ;

Notice : we have several independant messages with excalty the same content (header and body).
Careful, a composite destination named "queue.france.*" will not send the messages to all the queues, but to a queue named "queue.france.*".

ActiveMQ wilcards are very powerful with a very simple syntax and use.
Careful, this is not JMS compliant at all, but 100% ActiveMQ specific.

Talk you later.

Sunday, March 14, 2010

Camel framework introduction - Part 1

The issue of systems integration
In IT domain, we often have lots of heterogeneous systems which don't understand each other (different technologies, different communcation protocols, etc.).
But this is required and this is a need to be able to link those systems together, because systems which are not connected to each other have limited interest.

This raises many issues as data format, routes, monitoring, etc.
For instance, how do we do to connect two applications, where the first one speak old school CSV file although the second one does only understand XML over JMS ?

Entreprise Integration Patterns
Apache Camel is an integration framework, which implements EIP (Entreprise Integration Pattern) defined by Gregor Hohpe & Bobby Woolf.
EIP are integration patterns which enable us to resolv issues with proven solutions.
Camel framework supports about 50 EIP.

Endpoints represent systems, physical ressources, virtual ressources, etc.
For example, we have endpoints HTTP, JMS, FTP to interface with different protocols, but also endpoints Direct, Seda to be able to communicate into a same Camel context (we'll be back to this point).
2 types of Endpoints :
  • provider
  • consumer

  • Invoices directory: file://invoices/032010
  • Invoices JMS queue: jms://zenika/invoices

A route (path between 2 endpoints) can be very simple, or very complex as well (data transformation, multicast, messages filters, etc).
Routes enable us to route messages from origin to destination.

Camel can configure routes with 2 methods :
  • XML XBean configuration
  • DSL using (Domain Specific Language)

For example, this is a read of a file from a directory, then the write of this file into an other directory (very simple route) :
XML Method

<beans xmlns=""

 <camelContext xmlns="">
   <from uri="file://C://invoices//in" />
   <to uri="file://C://invoices//out" />

DSL Method
1. Java packages to scan listing (camel-context.xml file)

<beans xmlns="" xsi="" schemalocation="">

 <camelcontext xmlns="">

2. Routes coding

package com.zenika.camel.routes;

import org.apache.camel.builder.RouteBuilder;

public class InvoicesRoute extends RouteBuilder {

 public void configure() throws Exception {

DSL way is less verbose and simpler to maintain.
You only have to define Java packages to be scanned, and have to code routes in Java with the DSL.

This way is also type safe, and then much more secured than the XML way.
Indeed, it's impossible to code an operation which is not supported (compilation error).

Furthermore, all Camel syntax is fully supported in the XML way.

Camel context, heart of the framework
In order to use our route, we need a Camel context.
This context loads, configures and executes routes. This is the engine of the framework.
The framework is not dedicated to be used in standalone mode (except for testing purpose).
Camel must be used inside a container (ServiceMix, ActiveMQ, CXF or Tomcat).

Here is a simple example to create the Camel context :

package com.zenika.camel.test;

import org.apache.camel.CamelContext;
import org.springframework.beans.factory.BeanFactory;

public class Tester {
 public static void main(String... args) throws Exception {

  BeanFactory beanFactory = new ClassPathXmlApplicationContext("classpath:/camel-context.xml");
  CamelContext camelContext = (CamelContext) beanFactory.getBean("camelContext");

  Thread.sleep(2000); // to have time to run the route

With those few code lines, we have set up a route which copies all files from the invoices/in to the invoices/out directory.

We'll see next time other endpoints (as the Direct), and routes more complex as well, with data transformation and routing logic.

Tuesday, January 6, 2009

Testing with Oracle BPEL - part 3

When you create a new BPEL process from JDeveloper, you always have an empty Test Suites folder in the Integration Content folder. This is where will be all the tests.

Basic concepts :
  • test suite contains several tests (I recommend to have different test suite for each kind of tests you could have)
  • baseline is a common base for different tests. Each test can import a baseline to get a global behaviour (the create instance inbound message for example)
A simple process
Let's create a very simple sync BPEL process (it just copies 'OK' into the output variable). This process is called SimpleTest (source code available here).

A simple test for a simple process
Now we have our BPEL process, we want to test if our process replies 'OK' or not.
So just create a new test suite and then a new test.
You should have a new designer/source window opened. This is the test editor.
From there, you can emulate messages (inbound and outbound), add some asserts, etc.

We only want to check if our simple process replies 'OK'.

1. Emulate the inbound message
In each test, you must emulate the first inbound message (ie on the create instance invoke). This is a very common use for a baseline. Double click on the invoke activity > Emulate tab> Emulate message and then enter the content of the message.

2. Add assert activities
Then we are able to add assert activities on each BPEL activity which manipulates / transfers some variables (assign, invoke, receive, scope). Double click on our assign > Asserts tab > Create > Value Assert :
  • browse the output variable and select the result element
  • Comparaison method : String (this is the type of your element)
  • Expected value : OK
  • Error message : process is corrupted
  • Fatal : uncheck the box ! (This is really important. If not and if the test failed, you cannot get the results. The box is checked by default)
You should have something like that (the emulation on the receive, and the assert on the assign) :

3. Deploy the test
The BPEL process must be already deployed in order to realize this step.
In the deploy menu in JDev, you have the BPEL Process Deployer but also the BPEL Test Deployer. Select this test deployer, and check the test suite, your test and your BPEL server domain. And just deploy it.

4. Running the test
The simplest way to run the test is throught the BPEL console.
In all of the tabs that you have (manage, initiate, descriptor, WSDL, etc.) when you click on a BPEL process (not a BPEL instance), you also have the testsuites tab which is usefull to run tests & test suites. Just go in this tab and check your test suite with your test.

And execute tests !

5. Reporting
You now have a complete report of the state (passed or failed) of all your tests inside your different test suites.
I particulary like the % of process coverage by the unit tests (like a cobertura report). To get a 100%, you must cover all the different paths in your BPEL process by tests (including catchs, onAlarms, etc.).
You can even see the flow of the run BPEL testing instance.

You can modify your BPEL process and have a 'KO' instead of the 'OK'. You'll need to reploy your tests as well. You should get something like that :

Source code of tests here.

Happy new year !

Wednesday, December 3, 2008 on Jboss and Websphere

The Oracle SOA Suite on Jboss AS 4.0.5 and WebSphere Application Server have just released since the 25 of November.
Be carefull : the WAS version is now on fixpack althought the JBoss version is still on 4.0.5.

From Metalink
I prefer give you the patch numbers since they are not easy to find ...
WebSphere patchset

JBoss patchset

The install guides are inside the patchset.


Testing with Oracle BPEL - part 2

The writing of BPEL tests is done in JDeveloper, in a window which is similar to the BPEL process design. The tests are not coded with BPEL language and are not a standard as BPEL.

The testing language
The test design can be done by the designer or directly by writing XML tags, which is not really convenient, but there are some testing functionnalities not supported by the designer. That's why I will explain the main tags and attributes and their functions right now.

XMLtags & attributs Function/ Description
<BPELTest> Document root
<initiate @operation> Specify the behaviour of the test process instanciationreferencing a WSDL operation
<include> Include some other test (like a baseline)
<inboundMessage> Specify the incoming message
<emulate> Specify the activity is emulatedNotice : The <initiate> is always emulated
<activityDriver @activity> Do an action on an BPEL activity
<assertXML @variable,@part,@method> Assert the content of a XML variableaccording the method used (identical, similar)
<assertActivityExecuted @activity> Assert the number an activity is executed
<assertValue @var,@part,@method> Assert the content of a value variable (regexp, exactmatching)
<triggerOnMessage @onMessageName> Allow to emulate an incoming message on onMessageactivity (pick or onMessage)
<triggerOnAlarm @onAlarmName> Allow to emulate and trigger onAlarm activity

The above list is not complete, but it contains the main tags you will deal with.

Here is the hierachy in these tags :

If you want to have a overview of all the tags, you can consult the XML schema of the BPEL test language ($BPEL_HOME/bpel/system/xmllib/InstanceDriver.xsd)

With all this stuff, we'll able to do :
  • assert tests
    • XML variables asserts
    • values variables asserts
    • execution number asserts
  • emulation tests
    • incoming messages
    • invoke/receive/reply emulations (synchronous and asynchronous)
    • fault messages
    • on alarm triggers
Okay, next time, we'll do our first BPEL test.

Saturday, November 22, 2008

Testing with Oracle BPEL - part 1

One of the biggest challenge with the BPEL language is the unit testing.
How can I be sure that my tiny change in my BPEL process won't affect the global behaviour of my entire process ?

Test Driven Development
In test-driven development technique aka TDD, everything is based on tests. We create first the test, check if the new test fails when we run it, then write some code, and then check if the test succeed. In Java/J2EE, this technique is very powerfull and is used in extrem programming methodology.

Testing with Oracle BPEL
I recently find out Oracle BPEL provides a test framework (actually I knew it, but I never tried it because I wasn't very confident...).
This framework will enable us to use an approach very similar to TDD. In JDeveloper, we'll have our process design as usual and others windows with our tests design.

These next features are available :
  • emulate inbound and outbound messages (synch and asynch processes)
  • assert some values and XML data
  • assert the number of execution of an activity

With these functionnalities, we are now able to do :
  • lots of unit tests on our BPEL processes
  • integration tests

As in JUnit concept, all the tests can be unified in a test suite to run all tests together.
All the tests will be packaged with the BPEL suitcase.

Sunday, August 31, 2008

How to replay a scope in Oracle BPEL

An other useful tip is to know how to replay a scope from its begining.

There is an unknown bpel fault in Oracle which is the {}replay.
Generally, the namespace is called by the bpelx prefix. Then you can simply use the fault with :
<throw name="myReplayThrow" faultName="bpelx:replay"/>
You'll find the jdeveloper bpel process which shows how to use the replay fault here :

The fault makes your current scope returns to its begining as you can see on this shot :

It can really helps the bpel design avoiding to have to much complexity in a process.
Be careful since the replay fault is a bpel fault as shown in its name ! Therefore, it will be catched by a catchall on the current scope

Note : You can also use this fault with the faults policy manager in the, but you don't have to implement the retry logic since this is implicit.

I know you are several to follow this blog, and I'd like to thank you for your support.
Talk you soon guys !

Thursday, August 21, 2008

Reference on the current bpel instance from a XPath function

How to get a reference on the current bpel process into a xpath function ?
That's a big question ...

This is very simple, but you have to know which properties you have to get from the xpathContext.

package com.bpelsoa.xpath;

import java.util.List;
import java.util.Map;

import com.collaxa.cube.engine.CubeContextHelper;
import com.collaxa.cube.engine.ICubeContext;
import com.collaxa.cube.engine.core.ICubeInstanceImpl;

public class CubeInstanceXPath implements IXPathFunction {

  public Object call(IXPathContext context, List list)
      throws XPathFunctionException {

    Map xpathProperties = (Map) context.getVariableValue(null, null,"xpath-function-data");
    ICubeContext cubeContext = (ICubeContext) xpathProperties.get("ICubeContext");

    // get the cube instance from the cube context
    ICubeInstanceImpl cubeInstance = CubeContextHelper.getCubeInstance(cubeContext);

    // do something with cubeInstance ...
    return null;

You can do any operations on the cubeInstance object (such as modify a partner link, set a correlation id, change any properties, ...) to modify your bpel instance.

Tuesday, August 5, 2008

Oracle BPEL is out !

The new BPEL Process Manager from Oracle is finally out since the 30th of July !

This version is a patchset which can be installed on a (or more). That means you have to install the version before, and then install the patchset.
I regret this patchset wouldn't be a standalone installation... As usual, this is available only for OC4J applications servers (I know it should be available from September for IBM WebSphere).

Anyway, this new version is here, and I think Oracle BPEL is on a good way (good improvements, faster, usefull things).

The BPEL Console
This new version mainly focuses on the BPEL console by adding some gadgets as :
- improved statistics collection
- more visibility of the engine threading modele
- a XML validator to validation any requests before posting.

The BPEL Engine
- I find out and I think which is really good is the creation of a new asynchronous thread to feed the audit trail. In this case, if you start a new bpel process and if it crashes before the first dehydration point, you should be able to see the audit trail (how many times I tried some process which are impossible to debug since we do not have the audit trail .... !). I hope this point works.
- Embedded automatic recovery agent which can recover any messages or activities which would be in state failed (state unresolved or not handled by the dispatcher). This sounds very good because I get used to develop my own recovery scripts in order to recover this kind of unresolved messages ...
- JVM data collection as JVM thread dumps, JVM heap statistics

- Export of a process suitcase
- Deployement plan which is created in order to make easier the deployement on several environnements (developement, testing, production) which all have different hostnames and ports. It simply modify the URI of the import clause in the bpel descriptor file, XSD, WSDL ...

By the way, Jdeveloper is also out ! (but it seems even more buggy than the, so take care to your bpel source code).

Talk you soon.

Wednesday, July 16, 2008

Custom XPath function in Oracle BPEL PM


I'll present you today the way to do custom xpath function in Oracle BPEL Process Manager 10.1.3.x. This stuff is very usefull for basic things (as an isNumber() method, ID generator, ...) or more complex things (as XML operations, business stuff).

I did many projects with Oracle BPM 10, and I've got used to use lots of those functions.

Step 1 - Make a class which implements the IXPathFunction interface

The next class is a little tool which tests if a string is a number.
Class IsNumberFunction
package com.bpelsoa.xpath;

import java.util.List;

import org.w3c.dom.Node;

import com.collaxa.cube.xml.dom.DOMUtil;

* This implements a small tool which tests if a String is a Number.
* @author Raphaël
public class IsNumberFunction implements IXPathFunction {

  /** Number of args for this XPathFunction. */
  private static final int NB_ARGS = 1;

  /** Index in the List of our argument. */
  private static final int INDEX_ARG = 0;

   * Is called by the BPEL engine.
   * @see
   * .IXPathContext, java.util.List)
  public Object call(IXPathContext context, List args)
      throws XPathFunctionException {

    // test if we have the right argument number
    if (args.size() != NB_ARGS) {
      throw new XPathFunctionException(
          "This function requires one argument.");

    // extract the String of the argument from the BPEL process
    Object o = args.get(INDEX_ARG);
    String str = getValue(o);

    // call the business method
    return isNumber(str);

   * Extract the value of our String.
   * @param o object
   * @return a string which contains our value
   * @throws XPathFunctionException if error occurs
  private String getValue(Object o) throws XPathFunctionException {
    if (o instanceof String) {
      return ((String) o);
    } else if (o instanceof Node) {
      return DOMUtil.getTextValue((Node) o);
    } else {
      throw new XPathFunctionException("Unknown argument type.");

   * Test if a String is a Number.
   * @param str
   * the String to be tested
   * @return a boolean
  private boolean isNumber(String str) {
    for (int i = 0; i < str.length(); i++) {
      if (!Character.isDigit(str.charAt(i))) {
        return Boolean.FALSE;
    return Boolean.TRUE;

Step 2 - Register the xpath function to your BPEL domain
Edit the xpath-functions.xml file in the $BPEL_HOME/domains/bpelsoa/config directory.
Add these following lines into the bpel-xpath-functions tags.
<function id="isNumber">
  <comment><![CDATA[This implements a small tool which tests if a String is a Number. The signature of this function is bpelsoa:isNumber(String || Node).]]></comment>
  <property id="namespace-uri">
    <comment>Namespace URI for this function</comment>
  <property id="namespace-prefix">
    <comment>Namespace prefix for this function</comment>

Step 3 - Add your classfiles to the bpel classpath
Create a new directory in your domain home ($BPEL_HOME/domains/bpelsoa) called classes and add your classfiles into it or add your classfiles to your application directory (/product/your_app/classes). Don't forget to add the packages hierarchy.

Edit the shared library of your application server
  • OC4J : $ORACLE_HOME/j2ee/oc4j_soa/config/server.xml
-> locate the shared library called oracle.bpel.common
-> add a tag code-source with your classpath as the others code-source tags.
  • WebSphere 6.1 : In the administration console, go to shared library, select the oracleBPELServer scope, and edit the orabpel_sl lib
-> when editing the shared library, simply add your classpath with the others.

Step 4 - Using your new custom xpath function in a BPEL process
A custom xpath function can be used as any xpath functions. It has to be in an expression field from an assign activity (copy, append, insert after/before, etc.).
<assign name="xpathCall">
    <from expression="bpelsoa:isNumber('123')"/>
    <to variable="myBoolean"/>

Enjoy your new xpath.

That's all.

Thursday, July 10, 2008

Apache ODE 1.2 with Oracle Database 10g

Hi there,

It can be very usefull to change the database for many reasons (your customer wants to have this brand, your customer has some commercial discounts, support, etc...).

I'll will show you how to use the RDMS Oracle Database 10g with Apache ODE 1.2 .war version.

You'll need the sysdba privileges in order to follow the next steps.
You can get the oracle.sql script in the directory apache-ode-war-1.2/sql.

Create an ODE tablespace
Connect to the sid :
sqlplus sys/manager@xe as sysdba

Then execute the SQL statement :

Feel free to adapt this to your environement (the dbf path, the autoextend property and the initial size of the tbs).

Create an ODE schema
Execute the SQL statement :
-- Roles
-- System Privileges
-- tablespace Quota

Populate the ODE schema
Load the Apache ODE 1.2 schema :
sqlplus ode/ode@xe @oracle.sql
Create the JDBC datasource
Add this in the Host tag to the $CATALINA_HOME/conf/server.xml file :
<Context path="/ode" docBase="ode" debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/oracle/ode"

Bind the ODE engine to the oracle datasource
Add the file $CATALINA_HOME/webapps/ode/WEB-INF/conf/ with this content :

Add the Oracle JDBC Driver to the tomcat lib directory
Add the file ojdbc14.jar (which you can find in the lib directory of your $ORACLE_HOME) to the $CATALINA_HOME/lib directory.

Ok we're done, that's all !
Just restart the tomcat and it should work.

Wednesday, July 9, 2008

Apache ODE 1.2 is released

Hi folks,

This is my first technical post, and what is better than to announce the Apache ODE 1.2 release ?

This new release sounds very good for several points :
  • Improvements for stability and performance
  • External variables: variables used in a process are not opaque to the outside world anymore. You can map them to a simple database table and manipulate them directly. This means assigning to a variable has the effect of inserting or updating a row in the database, while reading a variable, has the effect of selecting a row from the database (I'll do a post on this feature to test it)
  • Advanced endpoint configuration support : WS-Security & WS-RM
  • New SQL scripts packaged in the ditribution (Derby, MySQL, Oracle)
  • Lots of bugs fixed !
Talk you soon.

Friday, June 27, 2008



This is a new blog which will be about all the SOA, BPM/BPEL, ESB concepts.

I'll try to explain different points as the best as I can in order to help you to fix all the potential issue which would occur.

Thanks a lot for reading this article.

Talk you soon.