{"id":3492,"date":"2011-09-27T12:49:06","date_gmt":"2011-09-27T17:49:06","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=3492"},"modified":"2011-09-29T10:10:16","modified_gmt":"2011-09-29T15:10:16","slug":"soa-11g-bpel-fault-policy","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=3492","title":{"rendered":"SOA 11g: BPEL Fault Policy"},"content":{"rendered":"<p>* See <a href=\"?p=3493\">this post<\/a> for an overview of BPEL faults.<br \/>\n* See <a href=\"?p=2708\">this post<\/a> for a SOA <em>11g<\/em> fault policy tutorial.<br \/>\n* See <a href=\"?p=1740\">this post<\/a> for SOA <em>10g<\/em> fault policy framework.<\/p>\n<span id=\"Fault_Management_Framework\"><h2>Fault Management Framework<\/h2><\/span>\n<span id=\"Fault_Binding\"><h3>Fault Binding<\/h3><\/span>\n<p>* Fault policy can be bound to:<br \/>\n&#8211; composite app<br \/>\n&#8211; BPEL and Mediator<br \/>\n&#8211; Reference binding components for BPEL and Mediator<\/p>\n<p><a id=\"PolicyFileLoc\"><\/a><\/p>\n<span id=\"Policy_File_Location\"><h3>Policy File Location<\/h3><\/span>\n<p>* Policy files:<br \/>\n&#8211; fault-policies.xml<br \/>\n&#8211; fault-bindings.xml<br \/>\n* Location:<br \/>\n&#8211; Defaults to same directory as composite.xml file.<br \/>\n&#8211; Also can be defined in following properties:<\/p>\n<pre lang=\"xml\">\r\n<property\r\n name=\"oracle.composite.faultPolicyFile\">oramds:\/apps\/faultpolicyfiles\/fault-policies.xml\r\n<\/property>\r\n<property\r\n name=\"oracle.composite.faultBindingFile\">oramds:\/apps\/faultpolicyfiles\/fault-bindings.xml\r\n<\/property>\r\n<\/pre>\n<span id=\"Binding_Resolution_Order\"><h3>Binding Resolution Order<\/h3><\/span>\n<p>-> Reference binding component defined in composite.xml file.<br \/>\n-> BPEL or Mediator service components defined in composite.xml file.<br \/>\n-> SOA composite applicaiton defined in composite.xml file.<br \/>\n-> BPEL catch activity.<\/p>\n<span id=\"Design_a_Fault_Policy\"><h2>Design a Fault Policy<\/h2><\/span>\n<span id=\"Create_a_Fault_Policy_file:_fault-policies.xml\"><h3>Create a Fault Policy file: <em>fault-policies.xml<\/em><\/h3><\/span>\n<p>* Create a fault policy file in the same directory as the composite.xml file.<br \/>\n&#8211; See <a href=\"#PolicyFileLoc\">here<\/a> if you want to place policy file in a different directory.<br \/>\n* Examples<br \/>\n&#8211; <a href=\"#faultPoliciesXml\">below<\/a>.<br \/>\n&#8211; <a href=\"?p=2708\">this tutorial post<\/a>.<\/p>\n<span id=\"Define_conditions\"><h3>Define conditions<\/h3><\/span>\n<p>* Same as for <a href=\"?p=1740#DefineConditions\">10g<\/a>.<\/p>\n<span id=\"Define_Actions\"><h3>Define Actions<\/h3><\/span>\n<p>* Same as for <a href=\"?p=1740#DefineActions\">10g<\/a>.<\/p>\n<span id=\"Create_a_Fault_Policy_Binding:_fault-buildings.xml\"><h3>Create a Fault Policy Binding: <em>fault-buildings.xml<\/em><\/h3><\/span>\n<p>* Create a fault binding file in the same directory as the composite.xml file.<br \/>\n&#8211; See <a href=\"#PolicyFileLoc\">here<\/a> if you want to place binding file in a different directory.<br \/>\n* Examples<br \/>\n&#8211; <a href=\"#faultBindingsXml\">below<\/a>.<br \/>\n&#8211; <a href=\"?p=2708\">this tutorial post<\/a>.<\/p>\n<span id=\"Example\"><h2>Example<\/h2><\/span>\n<p><a id=\"faultPoliciesXml\"><\/a>* fault-policies.xml file:<\/p>\n<pre lang=\"xml\">\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<faultPolicies xmlns=\"http:\/\/schemas.oracle.com\/bpel\/faultpolicy\">\r\n\t<faultPolicy version=\"2.0.1\" \r\n\t\tid=\"CRM_ServiceFaults\" \r\n\t\txmlns:env=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\" \r\n\t\txmlns:xs=\"http:\/\/www.w3.org\/2001\/XMLSchema\"\r\n\t\txmlns=\"http:\/\/schemas.oracle.com\/bpel\/faultpolicy\" \r\n\t\txmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\">\r\n\t\t<Conditions>\r\n\t\t\t<!-- Fault if wsdlRuntimeLocation is not reachable -->\r\n\t\t\t<faultName xmlns:bpelx=\"http:\/\/schemas.oracle.com\/bpel\/extension\"\r\n\t\t\t\tname=\"bpelx:remoteFault\">\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<test>$fault.code=\"WSDLReadingError\"<\/test>\r\n\t\t\t\t\t<action ref=\"ora-terminate\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<action ref=\"ora-java\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t<\/faultName>\r\n\r\n\t\t\t<!-- Fault if location port is not reachable-->\r\n\t\t\t<faultName xmlns:bpelx=\"http:\/\/schemas.oracle.com\/bpel\/extension\"\r\n\t\t\t\tname=\"bpelx:bindingFault\">\r\n\t\t\t\t<!--ORA-00001: unique constraint violated on insert-->\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<test>$fault.code=\"1\"<\/test>\r\n\t\t\t\t\t<action ref=\"ora-java\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t\t<!--ORA-01400: cannot insert NULL -->\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<test xmlns:test=\"http:\/\/test\">$fault.code=\"1400\"<\/test>\r\n\t\t\t\t\t<action ref=\"ora-terminate\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t\t<!--ORA-03220: required parameter is NULL or missing -->\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<test>$fault.code=\"3220\"<\/test>\r\n\t\t\t\t\t<action ref=\"ora-terminate\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<action ref=\"ora-retry-crm-endpoint\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t<\/faultName>\r\n\r\n\t\t\t<!-- Business faults -->\r\n\t\t\t<!-- Fault comes with a payload of error, make sure the name space is\r\n\t\t\tprovided here or at root level -->\r\n\t\t\t<faultName xmlns:credit=\"http:\/\/services.otn.com\"\r\n\t\t\t\tname=\"credit:NegativeCredit\">\r\n\t\t\t\t<!-- you get this fault when SSN starts with 0-->\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<test>$fault.payload=\"Bankruptcy Report\"<\/test>\r\n\t\t\t\t\t<action ref=\"ora-human-intervention\"\/>\r\n\t\t\t\t\t<!--action ref=\"ora-retry\"\/-->\r\n\t\t\t\t<\/condition>\r\n\t\t\t\t<!-- you get this fault when SSN starts with 1-->\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<test>$fault.payload=\"Bankruptcy Report-abort\"<\/test>\r\n\t\t\t\t\t<action ref=\"ora-terminate\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t\t<!-- you get this fault when SSN starts with 2-->\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<test>$fault.payload=\"Bankruptcy Report-rethrow\"<\/test>\r\n\t\t\t\t\t<action ref=\"ora-rethrow-fault\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t\t<!-- you get this fault when SSN starts with 3-->\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<test>$fault.payload=\"Bankruptcy Report-replay\"<\/test>\r\n\t\t\t\t\t<action ref=\"ora-replay-scope\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t\t<!-- you get this fault when SSN starts with 4-->\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<test\r\n\t\t\t\t\t\txmlns:myError=\"http:\/\/services.otn.com\">$fault.payload=\"Bankruptcy\r\n\t\t\t\t\t\tReport-human\"<\/test>\r\n\t\t\t\t\t<action ref=\"ora-human-intervention\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t\t<!-- you get this fault when SSN starts with 5-->\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<test>$fault.payload=\"Bankruptcy Report-java\"<\/test>\r\n\t\t\t\t\t<action ref=\"ora-java\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t<\/faultName>\r\n\t\t<\/Conditions>\r\n\r\n\t\t<Actions>\r\n\t\t\t<Action id=\"ora-retry\">\r\n\t\t\t\t<retry>\r\n\t\t\t\t<retryCount>3<\/retryCount>\r\n\t\t\t\t<retryInterval>2<\/retryInterval>\r\n\t\t\t\t<exponentialBackoff\/>\r\n\t\t\t\t<retryFailureAction ref=\"ora-java\"\/>\r\n\t\t\t\t<retrySuccessAction ref=\"ora-java\"\/>\r\n\t\t\t\t<\/retry>\r\n\t\t\t<\/Action>\r\n\t\t\t<Action id=\"ora-retry-crm-endpoint\">\r\n\t\t\t\t<retry>\r\n\t\t\t\t<retryCount>5<\/retryCount>\r\n\t\t\t\t<retryFailureAction ref=\"ora-java\"\/>\r\n\t\t\t\t<retryInterval>5<\/retryInterval>\r\n\t\t\t\t<retrySuccessAction ref=\"ora-java\"\/>\r\n\t\t\t\t<\/retry>\r\n\t\t\t<\/Action>\r\n\t\t\t<Action id=\"ora-replay-scope\">\r\n\t\t\t\t<replayScope\/>\r\n\t\t\t<\/Action>\r\n\t\t\t<Action id=\"ora-rethrow-fault\">\r\n\t\t\t\t<rethrowFault\/>\r\n\t\t\t<\/Action>\r\n\t\t\t<Action id=\"ora-human-intervention\">\r\n\t\t\t\t<humanIntervention\/>\r\n\t\t\t<\/Action>\r\n\t\t\t<Action id=\"ora-terminate\">\r\n\t\t\t\t<abort\/>\r\n\t\t\t<\/Action>\r\n\t\t\t<Action id=\"ora-java\">\r\n\t\t\t\t<!-- this is user provided class-->\r\n\t\t\t\t<javaAction\r\n\t\t\t\tclassName=\"com.oracle.bpel.client.config.faultpolicy.TestJavaAction\"\r\n\t\t\t\tdefaultAction=\"ora-terminate\" propertySet=\"prop-for-billing\">\r\n\t\t\t\t<returnValue value=\"REPLAY\" ref=\"ora-terminate\"\/>\r\n\t\t\t\t<returnValue value=\"RETRHOW\" ref=\"ora-rethrow-fault\"\/>\r\n\t\t\t\t<returnValue value=\"ABORT\" ref=\"ora-terminate\"\/>\r\n\t\t\t\t<returnValue value=\"RETRY\" ref=\"ora-retry\"\/>\r\n\t\t\t\t<returnValue value=\"MANUAL\" ref=\"ora-human-intervention\"\/>\r\n\t\t\t\t<\/javaAction>\r\n\t\t\t<\/Action>\r\n\t\t<\/Actions>\r\n\r\n\t\t<Properties>\r\n\t\t\t<propertySet name=\"prop-for-billing\">\r\n\t\t\t\t<property name=\"user_email_recipient\">bpeladmin<\/property>\r\n\t\t\t\t<property name=\"email_recipient\">joe@abc.com<\/property>\r\n\t\t\t\t<property name=\"email_recipient\">mike@xyz.com<\/property>\r\n\t\t\t\t<property name=\"email_threshold\">10<\/property>\r\n\t\t\t\t<property name=\"sms_recipient\">+429876547<\/property>\r\n\t\t\t\t<property name=\"sms_recipient\">+4212345<\/property>\r\n\t\t\t\t<property name=\"sms_threshold\">20<\/property>\r\n\t\t\t\t<property name=\"user_email_recipient\">john<\/property>\r\n\t\t\t<\/propertySet>\r\n\t\t\t<propertySet name=\"prop-for-order\">\r\n\t\t\t\t<property name=\"email_recipient\">john@abc.com<\/property>\r\n\t\t\t\t<property name=\"email_recipient\">jill@xyz.com<\/property>\r\n\t\t\t\t<property name=\"email_threshold\">10<\/property>\r\n\t\t\t\t<property name=\"sms_recipient\">+42222<\/property>\r\n\t\t\t\t<property name=\"sms_recipient\">+423335<\/property>\r\n\t\t\t\t<property name=\"sms_threshold\">20<\/property>\r\n\t\t\t<\/propertySet>\r\n\t\t<\/Properties>                   \r\n\t<\/faultPolicy>\r\n\t\r\n\t<faultPolicy version=\"2.0.1\" \r\n\t\tid=\"Billing_ServiceFaults\" \r\n\t\txmlns:env=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\" \r\n\t\txmlns:xs=\"http:\/\/www.w3.org\/2001\/XMLSchema\"\r\n\r\n\t\txmlns=\"http:\/\/schemas.oracle.com\/bpel\/faultpolicy\" \r\n\t\txmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\">\r\n\t\t<Conditions>\r\n\t\t\t<faultName>\r\n\t\t\t\t<condition>\r\n\t\t\t\t\t<action ref=\"ora-manual\"\/>\r\n\t\t\t\t<\/condition>\r\n\t\t\t<\/faultName>\r\n\t\t<\/Conditions>\r\n\t\t<Actions>\r\n\t\t\t<Action id=\"ora-manual\">\r\n\t\t\t\t<humanIntervention\/>\r\n\t\t\t<\/Action>\r\n\t\t<\/Actions>\r\n\t<\/faultPolicy>\r\n<\/faultPolicies>\r\n<\/pre>\n<p>* fault-bindings.xml file:<br \/>\n<a id=\"faultBindingsXml\"><\/a><\/p>\n<pre lang=\"xml\">\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<faultPolicyBindings version=\"2.0.1\"\r\n\txmlns=\"http:\/\/schemas.oracle.com\/bpel\/faultpolicy\"\r\n\txmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\">\r\n\r\n\t<composite faultPolicy=\"ConnectionFaults\"\/>\r\n\r\n\t<component faultPolicy=\"ServiceFaults\">\r\n\t\t<name>Component1<\/name>\r\n\t\t<name>Component2<\/name>\r\n\t<\/component>\r\n\r\n\t<!-- Below listed component names use polic CRM_SeriveFaults --> \r\n\t<component faultPolicy=\"CRM_ServiceFaults\">\r\n\t\t<name>HelloWorld<\/name>\r\n\t\t<name>ShippingComponent<\/name>\r\n\t\t<name>AnotherComponent\"<\/name>\r\n\t<\/component>\r\n\r\n\t<!-- Below listed reference names and port types use polic CRM_ServiceFaults\r\n\t--> \r\n\t<reference faultPolicy=\"CRM_ServiceFaults\">\r\n\t\t<name>creditRatingService<\/name>\r\n\t\t<name>anotherReference<\/name>\r\n\t\t<portType\r\n\t\txmlns:credit=\"http:\/\/services.otn.com\">credit:CreditRatingService<\/portType>\r\n\t\t<portType\r\n\t\txmlns:db=\"http:\/\/xmlns.oracle.com\/pcbpel\/adapter\/db\/insert\/\">db:insert_\r\n\t\tplt<\/portType>\r\n\t<\/reference>\r\n\r\n\t<reference faultPolicy=\"test1\">\r\n\t\t<name>CreditRating3<\/name>\r\n\t<\/reference>\r\n<\/faultPolicyBindings>\r\n<\/pre>\n<span id=\"References\"><h2>References<\/h2><\/span>\n<p>* <a href=\"http:\/\/download.oracle.com\/docs\/cd\/E17904_01\/integration.1111\/e10224\/bp_faults.htm#insertedID4\">Using the Fault Management Framework<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>* See this post for an overview of BPEL faults. * See this post for a SOA 11g fault policy tutorial. * See this post for SOA 10g fault policy framework. Fault Management Framework Fault Binding * Fault policy can &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=3492\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[100],"tags":[],"class_list":["post-3492","post","type-post","status-publish","format-standard","hentry","category-soa11g"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-Uk","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3492"}],"version-history":[{"count":9,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3492\/revisions"}],"predecessor-version":[{"id":3519,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3492\/revisions\/3519"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}