Tuesday, November 10, 2015

BPEL process and fault handeling

When it comes to bpel processes, you can handle the faults been thrown by using fault handlers. Suppose the process you invoke will throw custom fault responses. Then in your bpel process you could catch them and perform another sequence.

This is the definition of a fault handler.

<bpel:faultHandlers>
        <bpel:catch faultName="ns2:fault1" faultVariable="fault1"
            faultMessageType="ns2:fault1Response">
            <bpel:sequence>
                <!-- your custom sequence -->
            </bpel:sequence>
        </bpel:catch>

        <bpel:catch faultName="ns2:fault2" faultVariable="fault2"
            faultMessageType="ns2:fault1Response">
            <bpel:sequence>
                <!-- your custom sequence -->
            </bpel:sequence>
        </bpel:catch>

        <bpel:catchAll>
            <bpel:sequence>
                <!-- your custom sequence -->
            </bpel:sequence>
        </bpel:catchAll>


    </bpel:faultHandlers>


As above you could define any number of different catch sequences. 'catchAll' could be used to catch any other that didn't match other clauses. However the use of the faultVariable is, you could access the faults parameters from the fault variable defined. For example, if we are passing a parameter named 'errorCode' from the fault response, we could access it from the fault variable like below.


$fault1.parameters/errorCode



      

No comments:

Post a Comment