reffec.com

Download at WoweBook.Com in Java Generator pdf417 in Java Download at WoweBook.Com

Download at WoweBook.Com use none none printer toaccess none with none Microsoft Office Development. Microsoft Office 2000/2003/2007/2010 Adding Excep none for none tion Handling binding fault --> <test>$fault.code="20001"</test> <action ref="ora-rethrow-fault"/> </condition> </faultName>. <faultNam e xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:bindingFault"> <condition> <!-- Let the component handle this specific binding fault --> <test>$fault.

code="20001"</test> <action ref="my-java-handler"/> </condition> </faultName>. With this mo none none dification, you changed the exception-handling behavior from re-throwing the fault to running some Java code before re-throwing the fault.. 4. This cust om Java code will simply write the details of the fault to a log file and return. Once the Java code completes execution, depending on the return value of the Java call, the framework will take appropriate action.

In this case, the Java code always returns a status of OK and the exception-handling definition is set to re-throw the fault on receiving an OK. The following code snippet from fault-policy.xml shows how you define a Java fault handler.

The defaultAction attribute defines the action to be taken in case the Java class returns values that are not explicitly handled.. <!-- Cust none for none om Java Handler: Logs the fault details to a log file --> <Action id="my-java-handler"> <javaAction className="soatraining.faulthandling. MyFaultHandler" defaultAction="ora-terminate" propertySet="myProps"> <returnValue value="OK" ref="ora-rethrow-fault"/> </javaAction> </Action>.

This change for handling an exception was done without modifying either the BPEL component or the composite.. [ 352 ]. Download at WoweBook.Com 14 . 5. Ensure th at the directory c:\po\log exists. If you would like the log file to be created in a different directory, modify the logFileDir property in the fault-policies.

xml file. 6. Deploy the POProcessing composite and test using the same XML input as before.

You should see a file, myfaulthandler.log, in c:\po\log. You should also see that POProcessing handles the fault when you view the composite process instance in the Enterprise Manager console.

. Handling Mediator faults Since the Me diator doesn"t provide any built-in exception-handling mechanism, the policy-based fault handler is the only way to catch and handle exceptions occurring in the Mediator. A variety of exceptions can be caught ranging from adapter exceptions to transformation exceptions. In this exercise, you define an exception handler for catching all Mediator faults and use the custom Java handler to write a log file.

To force the Mediator to throw a fault, simulate a disk write error and have the File adapter throw an exception. 1. Modify fault-policies.

xml and add the following after the comment that contains the text Step #3. This defines a new fault handler for all mediator faults and refers to a new action called my-mediator-fault-handler..

<faultNam none for none e xmlns:medns="http://schemas.oracle.com/mediator/faults" name="medns:mediatorFault"> <condition> <action ref="my-mediator-fault-handler"/> </condition> </faultName>.

2. Now defin e the new action by adding the following XML to the fault policy file. Insert the following XML after the comment starting with Step #4.

This defines a Java action using the same custom Java class that you used in the earlier exercise but uses a different set of properties and also defines a different action to be performed on return from the custom Java call.. <Action i none none d="my-mediator-fault-handler"> <javaAction className="soatraining.faulthandling. MyFaultHandler" defaultAction="ora-terminate" propertySet="myMediatorProps"> <returnValue value="OK" ref="ora-human-intervention"> </returnValue> </javaAction> </Action>.

[ 353 ]. Download at WoweBook.Com Adding Exception Handling 3. Add the f none none ollowing after the comment starting with Step #5. This defines the property set that is to be used by the new javaAction.

. <property Set name="myMediatorProps"> <property name="logFileName"> mediator-faults.log </property> <property name="logFileDir">c:\po\log</property> </propertySet>. Property sets allow you to pass information to the Java class that will be handling the exception. 4. Open the routePO mediator component and change the route for the filter price*quantity < 1000 to Parallel from Sequential..

5. Select Yes when prompted. 6. You shoul d see the following change when you are done:. [ 354 ]. Download at WoweBook.Com 14 . Without this change, the fault policy handler will not get control when an exception occurs in the Mediator. This is because sequential routes are executed in the same thread and transaction context as the caller of the mediator service. If an exception occurs while executing a sequential route, it is thrown back to the caller and the fault handler is bypassed, otherwise, it could potentially break the transaction.

In case of a parallel route, a new thread and new transaction context is created by the Mediator, within which the route is executed. If an exception occurs while executing a parallel route, and a matching fault policy exists, the appropriate fault handler is executed..

7. Deploy th none for none e POProcessing composite. 8.

Change the permission of the directory c:\temp to read-only. This will force an error while writing the PO file. In Windows, open a command window and enter:.

Copyright © reffec.com . All rights reserved.