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=""
             xmlns:xsd="" xmlns="">
    <message name="RuntimeFaultMessage">
        <part name="code" type="xsd:string"/>
        <part name="summary" type="xsd:string"/>
        <part name="detail" type="xsd:string"/>

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
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.