Sharing Fault Policies Across Your Oracle BPM 11g Projects

This post is specifically about how to maintain and share enterprise level Fault Policies that can be re-used across all your BPM 11g projects. I’m assuming that you know enough about BPM/SOA Suite Exception Handling in general  using Fault Policies. If you are looking for more basic information on Fault Handling,  check Using Fault Handling In A BPEL Process  in the SOA Suite Developer’s Guide.

If you read the SOA Suite Developer’s Guide, it is clear that the best strategy is to maintain your Fault Policy and Fault Binding files in MDS and refer to them from all of your SOA/BPM projects.

Here’s a snippet that shows how to refer to Fault Policies shared via MDS in your composite.xml

Example 12–3 Fault Policies used by Multiple SOA Composite Applications
<property

name=”oracle.composite.faultPolicyFile“>

oramds:/apps/faultpolicyfiles/fault-policies.xml

</property>

<property

name=”oracle.composite.faultBindingFile“>

oramds:/apps/faultpolicyfiles/fault-bindings.xml

</property>

Although we understood this, the documentation does not explicitly specify how to implement this strategy . Well, to be fair , it kind of does,  but the information is pretty scattered across different topics within the Fusion Middleware Documentation. This post aims to bring all the information together in one place so that it becomes an easy reference for anybody trying to implement this strategy.

Here are the steps…

  • 1. Create a Shared SOA Application ( I call it SharedMetadataApp) to contain your Fault Policies.

We keep all our shared metadata across projects ( for example, some shared xsd files) in this SOA application. The shared fault policy files can be a part of the same application.

Lets create a new application (I call it SharedMetaDataApp) of type SOA Application.

Create SOA Application

  • 2. Create a SOA project (I call it SharedMetadata) in the SOA application with an empty composite

Create SOA Project

Empty Composite

 3. Create a new folder in the SOA project ( I call it FaultPolicies).

This is where we will be placing the Fault Policy and Binding Files.

Create Folder

4. Create the Fault Policy  and Binding files in this folder

Here is a starter Fault Policy file.

<?xml version=’1.0′ encoding=’UTF-8′?>

<faultPolicies xmlns=”http://schemas.oracle.com/bpel/faultpolicy“>

<faultPolicy

version=”2.0.1″ id=”EnterpriseFaultPolicy”               xmlns:env=”http://schemas.xmlsoap.org/soap/envelope/

xmlns:xs=”http://www.w3.org/2001/XMLSchema

xmlns=”http://schemas.oracle.com/bpel/faultpolicy

xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“>

<Conditions>

<faultName xmlns:bpelx=”http://schemas.oracle.com/bpel/extension

name=”bpelx:remoteFault”>

<condition>

<action ref=”ora-human-intervention”/>

</condition>

</faultName>

</Conditions>

<Actions>

<Action id=”ora-human-intervention”>

<humanIntervention/>

</Action>

</Actions>

</faultPolicy>

</faultPolicies>

Here is a starter Fault Policy Binding file

<?xml version=”1.0″ encoding=”UTF-8″?>

<faultPolicyBindings version=”2.0.1″

xmlns=”http://schemas.oracle.com/bpel/faultpolicy

xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“>

<composite faultPolicy=”EnterpriseFaultPolicy”/>

</faultPolicyBindings>

This is how your folder structure should look at this point.

Fault Policy Folder Structure

5.  Publish the Fault Policy and Binding Files to MDS

      a. Create a Jar Deployment Profile for the project.

Navigate to  Project Properties /Deployment.

You should see a SOA-SAR File deployment profile

SOA SAR Deployment Profile

Delete this profile.

Create a new Deployment Profile of type Jar file

Jar Deployment Profile

In the Deployment Profile properties, deselect the include Manifest file

Deselect Include Manifest

From Contributors, deselect Project Output Directory and Project Dependencies and add the Sharedmetadata project folder as a Contributor.

Deselect Project Output Directory and Dependencies

Add Contributor

Set the filters to select only the files you want to publish to MDS

Filters

That should be it for creating the Jar deployment profile.

b. Create a SOA-Bundle deployment profile

Navigate to Application Properties/Deployment and click on new deployment profile.Create a new Deployment Profile of Archive Type SOA Bundle. In the Dependencies select the Jar deployment profile we created in step (a).

SOA Bundle

SOA Bundle

SOA Bundle Dependencies 6.  Create a SOA-MDS Connection in JDeveloper, so that you can view the contents in MDS, once we deploy.

Make sure you select the soa-infra partition.

SOA-MDS Connection

Create SOA-MDS Connection

You will now see the connection in the Resource Palette , IDE Connections.

SOA-MDS In Resource Palette in IDE Connections

Expand the /apps folder and you should see that its empty (except for perhaps a readme file, which you can ignore)

Empty Apps Folder In SOA-MDS

7.  Deploy the policy files to MDS

Navigate to Application/Deploy/SharedMetadataBundle…

Application-deploy-SharedMetadataBundle

Deploy to Application Server

Deploy To Application Server

Deploy to SOA server

Deploy To SOA Server

After a successful deployment, refresh and expand the apps folder in your SOA-MDS connection ( in Resource Palette/IDE Connections).

You should now see the FaultPolicy folder in there with the FaultPolicy and Binding files.

8. Setting the reference to the Fault Policy in a BPM or SOA application that wants to use this policy.

Add these references in your Composite.xml

  <property name=”oracle.composite.faultPolicyFile”>

oramds:/apps/FaultPolicy/FaultPolicy.xml

</property>

<property name=”oracle.composite.faultBindingFile”>

oramds:/apps/FaultPolicy/FaultPolicyBinding.xml

</property>

Its important that you add these lines  after the last service definition and before the first component definition, otherwise the xml will not validate.

<service name=”SimpleWithNoLoggingService.service”

ui:wsdlLocation=”SimpleWithNoLoggingService.wsdl”>

<interface.wsdl interface=”http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleWithNoLoggingService#wsdl.interface(SimpleWithNoLoggingServicePortType)”

callbackInterface=”http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleWithNoLoggingService#wsdl.interface(SimpleWithNoLoggingServicePortTypeCallBack)”/>

<binding.ws port=”http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleWithNoLoggingService#wsdl.endpoint(SimpleWithNoLoggingService.service/SimpleWithNoLoggingServicePort)”/>

<callback>

<binding.ws port=”http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleWithNoLoggingService#wsdl.endpoint(SimpleWithNoLoggingService.service/SimpleWithNoLoggingServicePortTypeCallBack_pt)”/>

</callback>

</service>

<property name=”oracle.composite.faultPolicyFile”>oramds:/apps/FaultPolicy/FaultPolicy.xml</property>

  <property name=”oracle.composite.faultBindingFile”>oramds:/apps/FaultPolicy/FaultPolicyBinding.xml</property>     

<component name=”Simple”>

<implementation.bpmn src=”processes/Simple.bpmn”/>

</component>

9. Deleting the FaultPolicy from MDS.

Here are the steps when you need to do this…in case any  folder structure in MDS is obsolete or not correct and you want to recreate it.

Start WLST from the /Middleware /Oracle_SOA1/common/bin

execute the following command from the wlst prompt.

sca_removeSharedData (‘http://oelhost:8001‘, ‘FaultPolicy’, ‘weblogic’, ‘welcome1’)

first parameter : SOA Server url

second parameter : Folder under ‘apps’ you want to delete

third parameter: user id

fourth parameter: password

Jaideep

Jaideep has more than 20 years of professional software development experience. He has delivered solutions for several domains including financial services, e-Government, criminal justice, and wireless application services. He is a Certified Scrum Master and has mentored several teams to use agile software development techniques. He has delivered several SOA/BPM solutions based on the BEA/Oracle SOA Suite over the last 6 years . His current focus is on helping customers build solutions using Oracle BPM, Webcenter, ADF and SOA Suite 11g and 12c. Jaideep also trains teams on using Oracle BPM and has developed several self paced online video training courses for Oracle BPM 11g and 12c.
Jaideep

Leave a Reply

avatar
  Subscribe  
Notify of