In this article, we are going to learn about exception handling options available within SOA Suite 11g.
Exceptions can be divided into two categories: Business Faults, and Runtime Faults. Usually we let the Business Faults be handled at component level and Runtime Faults at framework level. BPEL and Mediator handle exceptions differently. Lets examine various scenarios:
When exceptions arise in synchronous requests, we will not get enough time to perform any corrective measures as response needs to be returned to the requestor immediately. In such cases, we can only return faults to the requestor. This is true for both BPEL and Mediator.
BPEL can catch, throw and compensate for exceptions. Mediator can catch multiple exceptions per operation and perform transformations before returning faults to the initial caller.
As the client of the service is not expecting an immediate response, asynchronous requests provide us with enough time to correct any issues arising in the request flow.
Error Hospital, an exception management tool provided by SOA Suite, lets us handle such exceptions through standard, out-of-the-box facilities. All requests with exceptions, if not handled explicitly, are sent to Error Hospital. Once enqueued, these requests can be examined and corrected through Enterprise Management console.
Fault Management Framework
SOA Suite 11g offers an excellent tool to handle exceptions at framework level. Usually business faults are handled at component level and system faults at framework level.
Fault Management Framework lets us handle exceptions through simple XML directives. Fault policies can be defined in a file called fault-policies.xml. We can declaratively specify exceptions to be handled through human intervention, retried, terminated or a combination of any of these actions.
These policies can be bound to the components of a composite at various granular levels. Please refer to Oracle documentation for more details.
Please see the Fault Management Tutorial to learn how to use validations and handle exceptions in a composite.