Tuesday, October 22, 2013

SOA AIAAsyncErrorHandlerBPELProcess Email Requirements

SOA AIA Error Handling

Error handling in SOA using  AIA Foundation pack. 
Exception handling in SOA can be achieved by calling  AIA FP OOB’s AIAAsyncErrrorHandlingBPELProcess.
AIAAsyncErrrorHandlingBPELProcess can be invoked in 2 ways.
1.       Using  fault policies
2.       Directly invoking  AIAAsyncErrrorHandlingBPELProcess from Catch Activity.

Using Fault Policies


Steps involved in using  fault policies.
1.       Add “EBM_HEADER” variable and populate “ EBM_HEADER “variable.
<variable name="EBM_HEADER" element="corecom:EBMHeader"/>
This variable is used in populating the  “FaultNotification”  element of AIAAsyncErrorHandlerBPELProcess, when invoked by fault policies.

Find the sample XSL used to populate EBM_HEADER


2.       Define a fault policy for the BPEL process and bind the process with this policy in fault-bindings.xml.
We can use specific fault policy for each process and store then in project directory or MDS.
We can use a Generic fault policy with covers standard exceptions and use the same in all BPEL processes. This policy has to be stored on MDS.

<property name="oracle.composite.faultPolicyFile">oramds:/apps/cfa/payroll/faultPolicies/fault-policies.xml</property>
    <property name="oracle.composite.faultBindingFile">oramds:/apps/cfa/payroll/faultPolicies/fault-bindings.xml</property>

3.       Populating FaultNotification element of AIAAsyncErrorHandlerBPELProcess’s Request message
Make sure “EBM_to_Fault.xsl” is in place in ‘XSL’ folder in project directory.  Fault polices  use this is transformation file to populate the notification message..

<from expression="ora:processXSLT('xsl/EBM_to_Fault.xsl',bpws:getVariableData('EBM_HEADER'))"/>                        <to variable="AIAAsyncErrorHandlingBPELProcessRequestMessage" part="FaultMessage"                             query="/corecom:Fault"/>
               
Above code is executed by fault policies to populate the FaultNotification Message.  SO EBM_HEADER variable and EBM_to_Fault.xsl are expected.
4.       Define catch and catchall blocks in BPEL process.

CompositeJavaAction in fault policies rethrow the error after the specified action. BPEL process catches that exception to show as faulted in EM console.  So we need to create separate Catch blocks for the exception conditions specified in fault policies.





Directly invoking AIAAsyncErrrorHandlingBPELProcess from Catch Activity.


  For Invoking  AIAAsyncErrrorHandlingBPELProcess directly from catch and catchall blocks, we can follow the steps as mentioned above or we can directly populate all the  elements in Catch or catchall blocks.
1.       Invoke AIAAsyncErrrorHandlingBPELProcess from Catch block.
2.       Populate atleast below elements in the Request message body
1.       CompositeInstance ID
2.       BPEL Process Name
3.       Payload Key (  Location number, employee number)
4.       TimeStamp
3.       Once the AIAAsyncErrrorHandlingBPELProcess has been invoked. Rethrow the exception, so that process appears as faulted in EM console