Click the Skip Condition tab.

11 Using Fault Handling in a BPEL Process 11-1 11 Using Fault Handling in a BPEL Process This chapter describes how to use fault handling in a BPEL process. Fault handling allows a BPEL process service component to handle error messages or other exceptions returned by outside web services, and to generate error messages in response to business or runtime faults. You can also define a fault management framework to catch faults and perform user-specified actions defined in a fault policy file. This chapter includes the following sections: ■ Section 11.1, Introduction to a Fault Handler ■ Section 11.2, Introduction to BPEL Standard Faults ■ Section 11.3, Introduction to Categories of BPEL Faults ■ Section 11.4, Using the Fault Management Framework ■ Section 11.5, Catching BPEL Runtime Faults ■ Section 11.6, Getting Fault Details with the getFaultAsString XPath Extension Function ■ Section 11.7, Throwing Internal Faults ■ Section 11.8, Rethrowing Faults with the Rethrow Activity ■ Section 11.9, Returning External Faults ■ Section 11.10, Using a Scope Activity to Manage a Group of Activities ■ Section 11.11, Re-executing Activities in a Scope Activity with the Replay Activity ■ Section 11.12, Using Compensation After Undoing a Series of Operations ■ Section 11.13, Stopping a Business Process Instance ■ Section 11.14, Throwing Faults with Assertion Conditions For additional information on creating fault handling in a SOA composite application, see the Fusion Order Demo application.

11.1 Introduction to a Fault Handler

Fault handlers define how the BPEL process service component responds when web services return data other than what is normally expected for example, returning an error message instead of a number. An example of a fault handler is where the web service normally returns a credit rating number, but instead returns a negative credit message. 11-2 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Figure 11–1 provides an example of how a fault handler sets a credit rating variable to -1000. Figure 11–1 Fault Handling The code segment in Example 11–1 defines the fault handler for this operation in the BPEL file: Example 11–1 Fault Handler Definition faultHandlers catch faultName=services:NegativeCredit faultVariable=crError assign name=crin copy from expression=-1000 from to variable=input part=payload query=autoloan:loanApplicationautoloan:creditRating copy assign catch faultHandlers The faultHandlers tag contains the fault handling code. Within the fault handler is a catch activity, which defines the fault name and variable, and the copy instruction that sets the creditRating variable to -1000. BPEL Process receive Credit Rating Service Negative Credit scope WSDL prepare crin assign scope credit to -1000 assign Read crOut assign WSDL d1 d3 f1 reply d2 call service invoke