Gaining experience with fault handling in WS-BPEL 2.0 business processes

I’ve been assigned a task to migrate legacy Oracle WebLogic Integration (JPD) business processes to IBM Business Process Manager 8.0 Advanced (WS-BPEL 2.0). The task has been to migrate fault handling in a JPD business process to a BPM one. Unlike WLI in which “Custom Java code is an essential part of every Oracle WebLogic Integration (WLI) business process (JPD)”, in BPM Advanced an integration developer uses Java very rarely. I could not be mistaken saying that using Java in a BPEL process is an exception not a rule and (guessing) should be deemed slightly inappropriate.

I reviewed the sample Fault Handling in IBM Business Process Management Samples and guess I seem to have grown to understand it slightly better. It’s so much easier when you look at a business process model with an exception handler as one big method body of a Java class.

It did help me to understand the topic when I mentally mapped fault handling in BPEL to exception handling in a Java method with try/catch/finally blocks around the code that could be a source of an exception. It doesn’t have to be that Java is the only viable language to map WS-BPEL 2.0 models to, but since I’ve been working with Java quite extensively, my mental model is built around the object-orientation as Java taught me for years. It became quite natural that somehow somewhere something needs to take action when an exception’s thrown. Easy, isn’t it?

In a Snippet activity, I wrote the following Java snippet to instantiate a business object of anySimpleType XSD type to wrap the fault.

BOFactory boFactory = (BOFactory) ServiceManager.INSTANCE.locateService("com/ibm/websphere/bo/BOFactory");
BOType boTypeService = (BOType) ServiceManager.INSTANCE.locateService("com/ibm/websphere/bo/BOType");
Type anySimpleType = boTypeService.getType("http://www.w3.org/2001/XMLSchema", "anySimpleType");
System.err.printf(">>> anySimpleType: %s %n", anySimpleType);
//e = boFactory.createByType(anySimpleType);
e = boFactory.createDataTypeWrapper(anySimpleType, getCurrentFaultAsException());
System.err.printf(">>> e: %s %n", e);

I wish I knew how to do it with an Assign activity. You know? Let…me…know. Thanks!

This is a sample BPEL process model with an process-level, Catch All fault handler.

It was quite fun developing Java code visually for a Snippet activity. Guess what the following snippet does. It should be a breeze provided you’ve developed applications before.

What I learnt while having developed the Snippets was that to handle an exception in the Visual mode, a red error marker is shown, albeit there’s no visual artifact to drag and drop from the Palette (on the left-hand side of the editor).

What you have to do is to right-click the exception node (shall I say a fault terminal?) and select Add > Exception Handler. I didn’t know that (!)

On to the other assignments in the migration. Exception handling has showed me there’s quite a bunch of work to do.

Be Sociable, Share!
This entry was posted in WebSphere.

Leave a Reply

%d bloggers like this: