Handling Message Errors: A Sample Scenario This section describes how to

ADAPTER Life-Cycle Management 2-33 If the message cannot be delivered to Q1 or to any one of the queues but the message is delivered to queues Q2 and Q3, the transaction must roll back all the three messages because all are XA resources and there is an exception in one of XA unit. The rollback exception is thrown only for the second composite where Q1 failed, and the transactions commits Q2 and Q3 instead of rolling back the messages for all the three queues. To have the transaction roll back all the queues even if only one fails, and for the other two have messages successfully delivered to them, you must make the change in the composite.xml file of the called composite Composite2 as Example 2–4 shows: Example 2–4 Changes in composite.xml of Composite2 component name=BPELProcess1 implementation.bpel src=BPELProcess1.bpel property name=bpel.config.transactionrequiredproperty component This sets the property bpel.config.transaction to the value of required, which causes the transaction to roll back all the queues even if only one fails. Note that if you set property bpel.config.transaction to a value of required, the Oracle BPEL engine effectively processes the synchronous request without creating a new transaction; rather, it uses the callers transaction. Therefore, if at any point the transaction gets rolled back, nothing done in that transaction will commit.

2.22.2 Inbound Interaction Error Handling

You can indicate the way inbound adapters should handle errors by specifying rejected message handlers.

2.22.2.1 Message Error Rejection Handlers

You can create rejection handlers to handle message errors. Message errors include those that occur during translation, correlation ID mismatch and XML parsing after message reception.

2.22.2.1.1 Available Rejection Handlers for Message Errors

Before considering error handling in terms of retryability, it is important to understand the error handlers that are available. The following are the system-defined error handlers, which you can configure via fault policies:. ■ Web Service Handler ■ Custom Java Handler ■ JMS Queue ■ File

2.22.2.1.2 Web Service Handler

A rejected message can be handled by calling a Web Service. If you choose to use a Web Service to handle these errors, you should implement a predefined WSDL interface implemented by the target service, SOAP bindings for the Web service invocaiton, and native payloads passed as WebService-attachments, as shown in the following example: Action id=ora-ws 2-34 Oracle Fusion Middleware Users Guide for Technology Adapters invokeWS uri=WebServiceURI -- format - Absolute wsdl path|service name|port name -- Action The WSDL Interface for the Web Service handler must have one port type, only one input operation, and a schema for the input message. This is shown in the following example. ?xml version=1.0? schema xmlns=http:www.w3.org2001XMLSchema targetNamespace=http:xmlns.oracle.compcbpelerrorHandling xmlns:tns=http:xmlns.oracle.compcbpelerrorHandling elementFormDefault=qualified element name=RejectedMessage type=tns:RejectedMessageType complexType name=RejectedMessageType sequence element name=MessageHeader type=string -- base64 encoded string -- element name=MessagePayload type=string -- base64 encoded string -- element name=RejectionReason type=string sequence attribute name=RejectionId type=string complexType schema

2.22.2.1.3 Custom Java Handler

Another option to handle errors is to create a predefined Java framework, an interface, that will forward errors. You can implement a Java interface by the target class, as shown in the following example. Action id=ora-custom javaAction className=mypackage.myClass defaultAction=ora-terminate returnValue value=SUCCESS ref=ora-file returnValue value=FAILED ref=ora-ws javaAction Action The interface itself specifies a fault recovery class. See the following snippet for an example of the interface. package oracle.integration.platform.faultpolicy; public interface IFaultRecoveryJavaClass { public void handleRetrySuccess IFaultRecoveryContext ctx; public String handleFault IFaultRecoveryContext ctx;}

2.22.2.1.4 JMS Queue

You can enqueue a rejected message to a JMS queue as a JMS message with the appropriate context and payload, as shown in the following two examples. The first example uses a standalone database: Action id=ora-queue enqueue uri=QueueURI -- QueueURI format - jdbc:oracle:thin:host:port:sidunpwqueue -- Action