Oracle BPEL Fault Policy Framework handling custom business faults

From the Oracle forum and from the comments on my article about Oracle BPEL Fault Policy Management i get a lot of questions about how to let the framework handle my own custom defined ‘business faults’.
In certain situations the default set of faults defined by Oracle aren’t suited enough and you need to define your own faults.
If we look into the examples which got supplied by Oracle we can see an example over here. In this example they defined their own NegativeCredit-fault.

The Oracle BPEL Fault Policy Framework by default only handles the faults which are getting returned on an invoke-activity.
So we have our own custom fault and the knowledge we can only let this fault getting catched by the framework by use of an invoke.
So we need atleast for this testscenario 2 bpel processes. One mainprocess which calls a subprocess, and this subprocess will throw the custom business fault.
This fault will get propogated back to the mainprocess and in here we will be able to let the framework handle the fault.

bpel-invoke

BPEL Processes

Mainprocess

mainprocess

Subprocess
subprocess

Just a simple invoke of the subprocess from the mainprocess. The subprocess with throw a fault, and this fault will be catched in the mainprocess.
throwThe fault to be thrown

From the console start the mainprocess and wait till it comes back with a fault messageinvoke-faultedClick the activity to see the thrown fault

[2009/02/13 16:24:41]
"{http://nl.iteye/integration/faults/business}BusinessFault" has been thrown.

<businessFault xmlns="http://nl.iteye/integration/faults/business">
<part name="payload">
    <businessFault xmlns="http://nl.iteye/integration/faults/business">
      <faultCode>999</faultCode>
      <faultMessage>Something went wrong!</faultMessage>
    </businessFault>
  </part>
</businessFault>

Ok nice!
So the custom fault we defined in the subprocess reaches the mainprocess.
Now we need to config the fault policy framework so it will get active on our custom business fault.
From the fault we pasted above we need the faultname (BusinessFault) and the namespace (http://nl.iteye/integration/faults/business).

Edit /bpel/domains/default/config/fault-policies/DefaultPolicy.xml and add the next fault :

   <faultName xmlns:flt="http://nl.iteye/integration/faults/business" name="flt:BusinessFault">
            <condition>
                    <action ref="ora-human-intervention"/>
            </condition>
   </faultName>

For testing we will just let this fault getting handled by human-intervention.
Now restart the components

opmnctl stopall
opmnctl startall

Now start the mainprocess again and wait till it fails.

invoke-faulted-frameworkIt looks like the framework got active (activity yellow marked) on our custom business fault.
invoke-faulted-audit

Go to the activities-tab

list-activities
And click the activity which faulted.

edit-activity
Now we can edit some of the values and let the subprocess get re-invoked.

So, at this moment we’re able to throw our custom business faults and let them getting catched by the framework. Since the fault is only getting catched on the invoke of a partnerlink, we aren’t able to let our custom business fault getting throwned to the process in which we maybe want do something with the data for which we actually throwed the custom business fault. So maybe we want to stay in the subprocess and somehow get the custome business fault thrown inhere, let the framework catch it and update the values of this subprocess with new values an re-execute the subprocess.

The next solution will get this done.
The mainprocess won’t get changed but in the subprocess we will invoke a new process called AllBusinessFaults.

New subprocess 2
subprocess2

AllBusinessFaults
all-business-faults

The AllBusinessFaults will throw the custom business fault we ‘request’ back on the invoke in this subprocess. Now it wil get catched by the framework and we will be able to change the values of the subprocess instead of the mainprocess.

list-activities2

By using the AllBusinessFaults bpel service like a sort of composite service, we can add the custom business faults in it and throw the one we would like to get thrown. This will work if the collection of custom business faults isn’t that big. I’m sure there will be better solutions for this, but for the scenario i wanted to describe inhere it was good enough for me.

Question
In the examples i provided i don’t use the fault-part of a synchronous invoke to propegate the soap-fault back to the caller, i just throw the fault. The bpel engine itself throws the fault back to the first-level. Whats best practice on this one ?

Sources
BPEL Sources (First part of article with mainprocess/subprocess)
BPEL Sources (Second part of article with mainprocess/subprocess/allbusinessfaults)

Resources
Oracle BPEL 10.1.3.3 Fault Policy Management

Original blog

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

12 Responses to “Oracle BPEL Fault Policy Framework handling custom business faults”

[…] Oracle BPEL 10.1.3.3 Fault Policy Management my blog Share and […]

commenter

Hi ,

Good one. But i wasn’t able to download the Bpel Sources. Is there any chance that I could have them.

Thanks in advance.

commenter

Hi Ravindranath,

I updated the download links.

Good luck!

commenter

Wow, very nicely explained..i am raring to go and try this out.

commenter

The best information i have found exactly here. Keep going Thank you

commenter

I did not get caller process receiving back thrown fault from called process, but got instead of it timeout error. I am using BPEL 10.1.3.3 on WebLogic and fault policies works ok on ‘normal’ invoke errors.

Found some info on participate that if added to BPEL descriptor of caller process, under section of relevant partner link binding, would insure that errors are propagated between two BPEL processes, but didn’t work. And your samples do not have this parameter in use either.

Both of BPEL processes are with closed.faulted status.

Do you have some suggestions on why thrown faults when there is no catch block do not get propagated to caller even in the case that called process is synchronous?

Thanks in advance

commenter

Hi,

I can not create my own fault message.
I have received:

fpre:technicalFault
….

But I would like to received inside of SOAP Body message just my fault as it is in tag .I don’t wanna faultcode, faultstring, faultactor and detail tags.

Could you please help me?

commenter

Actually I have received:

0


oracle.fabric.common.FabricInvocationException

null


null

but I would like my custom fault message

commenter

Hi Eric,
I have a requirement,One interface say Hello world.How can I get the number request’s (count) for this interface and also in that count how to know how many are completed and how many are faulted.
When I follow some blogs,they were say it’s possible with BAM.
But I have no idea about BAM.If is there any alternative please give directions and instruction how to achieve this task.
Thanks in advance.

Regards
Mani

commenter

is it not possible to throw a custom fault and catch it using fault handling framework(fault policies)

We dont want to call another sub bpel process

scenario:- in Our bpel process we call an oracle api … which will return code and message… in case the code is E which means error,(we have to explicitly throw a custom error and catch it using fault handling framework ) we have to send a mail using fault handling framework

commenter

As far as i can see the framework will only catch the faults on the invoke activity, so it will not get triggered by a custom throw fault in the prcocess itself. I assume you don’t want to create some sort of error hospital process and invoke this one from the catch handler in your process itself? (since this will force you to implement extra logic in the process each time again)

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>