Databases Reference
In-Depth Information
Returning faults
If at runtime the
verifyCreditCard
operation returns a fault of type
invalidCreditCard
, then this will be caught by the
<catch>
branch we
defined on the
VerifyCreditCard
scope.
This fault handler will throw an
invalidUserDetails
fault, which will get
caught by the
<catch>
branch defined against our process. This will execute the
Compensate
activity triggering the compensation handler on the
CreateUser
scope,
which will delete the previously inserted user record.
The final step is to return an
invalidUserDetails
fault to the caller of the BPEL
process. To return a fault within BPEL, we use the
Reply
activity. The difference is to
configure it to return a fault as opposed to a standard output message, as shown in
the following screenshot:
Here we have configured the
Partner Link
and
Operation
as you would for a
standard reply. However, for the
Variable
we need to specify a variable that contains
the content of the fault to be returned. In our case, this is the content of the fault
caught by our process level fault handler (and populated by the fault handler for
the
ValidateCreditCard
scope).
Finally, we need to specify that an
invalidUserDetails
fault should be returned.
Specify this by clicking on the
search
icon in the
Fault QName
panel to launch the
now familiar
Fault Chooser
. After returning the fault, the process will be completed.