A fault response to an invoke activity uses the definition of the fault in the WSDL operation. A WSDL fault is defined by using the target namespace of the port type and the fault name.
Example: Purchase Order BPEL Process
In a normal purchase order BPEL process, the following steps occur:
A customer sends in a purchase order.
The BPEL process receives a purchase order and performs tasks for calculating shipping and production costs.
The BPEL process returns an invoice to the customer.
If something goes wrong, the process returns an error. Fault messages are defined in the WSDL file and used in the BPEL process as described in the following example:
In the WSDL definition above, the operation called
sendPOrder
specifies the fault named
cannotCompletePO
that is used by the BPEL process if the purchase order cannot be completed. In the BPEL process fault handlers section, the catch activity contains a reply defined to return a message in the
POFault
variable in the event that a fault is received.
When an invoke operation returns a fault message, it causes a fault in the current scope. The fault variable in the corresponding
<catch>
is initialized with the fault message received.
If a Web service operation is not defined with a fault message, you can use the Process Developer custom functions to catch undeclared faults.
For more information, see
Adding a Fault Handler as a Boundary Event for an Invoke Activity