Sunday, August 14, 2016

How To: Throw a custom fault/ exception in BPEL (SOA-Fault Handling)

Fault Handling in SOA is analogous to Exception Handling in OOPs. Below is how to throw a fault in a BPEL process:

1 - Define the fault message type

Add the RuntimeFault.wsdl to the Project/SOA/WSDLs folder. This WSDL contains the message definition of the fault that will be thrown at runtime.

<?xml version="1.0" encoding="UTF-8" ?>
<definitions name="RuntimeFault" targetNamespace="http://schemas.oracle.com/bpel/extension"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/">
    <message name="RuntimeFaultMessage">
        <part name="code" type="xsd:string"/>
        <part name="summary" type="xsd:string"/>
        <part name="detail" type="xsd:string"/>
    </message>
</definitions>

2 - Define the fault variable to hold the fault

Define a new BPEL variable with the message type "RuntimeFaultMessage" created in the step above.

Variable Name: faultVar
Type: Message Type
Namespace: http://schemas.oracle.com/bpel/extension
Local Part: RuntimeFaultMessage

3 - Create a throw activity

Drag and Drop the "Throw" activity from the Components Menu into your BPEL process.

Activity Name: ThrowFault
Namespace: <Target Namespace of your BPEL process>
Local Part: <Name the Fault>
Fault Variable: faultVar (fault variable created in the step above)



Hope you find this information useful.Please share your feedback below. I would love to hear from you.

CaptiveCode

4 comments:

  1. This is a brilliant blog! I'm very happy with the comments!..Fault Location Services Queen Charlotte

    ReplyDelete
  2. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! Fault Location Services Annandale

    ReplyDelete
  3. This specific is a great article My spouse and i witnessed due to talk about the idea. It is definitely precisely what I want to to view expect throughout potential you can proceed pertaining to expressing a real exceptional article. Fault Location Services Crofton

    ReplyDelete