IBM BPM, V8.0.1, All platforms > Programming IBM BPM > Developing client applications for BPEL processes and tasks > Developing EJB client applications
Handling exceptions and faults
A BPEL process might encounter a fault at different points in the process.
Business Process Execution Language (BPEL) faults originate from:
- Web service invocations (Web Services Description Language (WSDL) faults)
- Throw activities
- BPEL standard faults that are recognized by Business Process Choreographer
Mechanisms exist to handle these faults. Use one of the following mechanisms to handle faults that are generated by a process instance:
- Pass control to the corresponding fault handlers
- Compensate previous work in the process
- Stop the process and let someone repair the situation (force-retry, force-complete)
A BPEL process can also return faults to a caller of an operation provided by the process. You can model the fault in the process as a reply activity with a fault name and fault data. These faults are returned to the API caller as checked exceptions.
If a BPEL process does not handle a BPEL fault or if an API exception occurs, a runtime exception is returned to the API caller. An example for an API exception is when the process model from which an instance is to be created does not exist.
The handling of faults and exceptions is described in the following tasks.
- Handling Business Process Choreographer EJB API exceptions
If a method in the BusinessFlowManagerService interface or the HumanTaskManagerService interface does not complete successfully, an exception is thrown that denotes the cause of the error. You can handle this exception specifically to provide guidance to the caller.
- Checking which fault is set for a human task activity
When a human task activity is processed, it can complete successfully. In this case, you can pass an output message. If the human task activity does not complete successfully, you can pass a fault message.- Checking which fault occurred for a stopped invoke activity
In a well-designed process, exceptions and faults are usually handled by fault handlers. You can retrieve information about the exception or fault that occurred for an invoke activity from the activity instance.- Checking which unhandled exception or fault occurred for a failed process instance
In a well-designed process, exceptions and faults are usually handled by a fault handler. If the process implements a two-way operation, you can retrieve information about a fault or handled exception from the fault name property of the process instance object. For faults, you can also retrieve the corresponding fault message using the getFaultMessage API.
Developing EJB client applications for BPEL processes and human tasks
Related concepts:
Fault handling in BPEL processes