To understand how to use fault handling, we need to learn the basic architecture of a Service Composite in Oracle SOA Suite.
Service components − BPEL Processes, Business Rule, Human Task, Mediator. These are used to construct a SOA composite application.
Binding components − Establish connection between a SOA composite and external world.
Services − Provides an entry point to SOA composite application.
Binding − Defines the protocols that communicate with the service like SOAP/HTTP, JCA adapter, etc.
WSDL − Defines the service definition of a web service.
References − Enables a SOA composite application to send messages to external services
Wires − Enables connection between service components.
Let us now see the different types of faults.
Occurs when application executes THROW activity or an INVOKE receives fault as response. Fault name is specified by the BPEL process service component. The fault handler using Fault name and Fault variable catches this fault.
This is thrown by the system. These faults are associated with RunTimeFaultMessage and are included in
http://schemas.oracle.com/bpel/extensionnamespace.
In this section, we will learn about the different ways of fault handling.
Throw activity explicitly throws the fault. The catch block catches this fault and the corresponding actions get executed thereby.
Using throw activity, you can throw business faults & within the created scope, you can catch this fault and redirect to the caller (consumer) to take action.
Instead of the above approach, you throw the same fault caught in catch activity of the created scope. In the main scope, you can catch this fault using the catchall activity.
The 2 main files used in EHF are −
Whenever the BPEL process throws an error, the EHF will check whether the error exists in Fault-Bindings.xml files. If so, the action in the Fault-Policy.xml file will be taken. If the action is not found, the fault will the thrown and it will be handled in the catch block.
Fault management framework (Fault-Policy.xml and Fault-Bindings.xml) is kept inside a SOA Composite.
Fault-handlers like catch and catchall are inside a BPEL to catch all faults, but fault policies will only be executed when an invoke activity fails.