Sunday, July 13, 2014

One component of Oracle SOA Suite is the Fault Management Framework, which mmj. care of exception h


One component of Oracle SOA Suite is the Fault Management Framework, which mmj. care of exception handling in BPEL. If you invoke activity occurs during exception framework it to capture and transmit it to process the event, which is defined in the fault policy. These policies are an interesting alternative to catching exceptions in the actual BPEL fault handler using <catch>. It can be seen as an aspect (in the sense of AOP), which is pegged to the process declaratively (or even the entire composite application). Well, if I told aspect, I probably aroused great expectations. So it is unfortunately not - I myself had to bury some of their design ideas - it has a lot of limitations, respectively. options are extensive. So what does it actually do? Under the policy can be defined as follows zotavné Action: Retry. Poor invoke can be repeated. One can set the number of retries, delay, delay and exponential subsequent chained action if retry will not work. Human Intervention. The process stops and can be manually reset from the management console. Terminate Process. The process is terminated. Same as activity. exit. Rethrow Fault. The error is thrown back to the BPEL process. Replay Scope. Throws reply fault, causing kent beverage the re-execution of activities in scope. kent beverage Java Code. Calls the external Java class. That's what we will continue to focus. The problem I have for the client to the service SoapFault, which has in its contract defined SOAP Fault: <xsd: element kent beverage name = "fault"> <xsd: complexType> <xsd: sequence> <xsd: element name = "ResultCode" type = "xsd : string "/> <xsd: element name =" error "> <xsd: complexType> <xsd: sequence> <xsd: element name =" errorCode "type =" xsd: string "/> kent beverage <xsd: element name =" ErrorDescription "type =" xsd: string "/> </ xsd: sequence> </ xsd: complexType> </ xsd: element> </ xsd: sequence> </ xsd: complexType> </ xsd: element> To graphically oriented It looks like this:
This fault is then used in the WSDL: <wsdl: message name = "faultMessage"> <wsdl: part name = "payload" element = "INP1: fault" /> </ wsdl: message> <wsdl: portType name = "SOAPFaultPort "> <wsdl: operation name =" test "> <wsdl: input message =" tns: requestMessage "/> <wsdl: output message =" tns: replyMessage "/> <wsdl: fault name =" testfault "message =" tns: faultMessage "/> </ wsdl: operation> </ wsdl: portType> service is implemented using BPEL process, under the orchestration calls another service, called BPELFault:
Thus, it was exposure. Now comes the collision. I have defined in BPEL invoke activity that calls an external service BPELFault. I would use the policy so that when the external service returns an error that I set my policy defined SOAP fault and process it back to the client. Before delving into the implementation of the policy, we must BPEL process still meet two conditions. First, in the process of defining a variable that will be set as the message type fault: <variable name = "SoapFault" MessageType = "ns1: faultMessage" /> A sophomore, the process must be our fault throw out activities using throw: <catchall> kent beverage <throw name = "ThrowFault" faultName = "ns1: testfault" faultVariable = "SoapFault" /> </ catchall> How does it work? A picture is worth a thousand words, so here is a BPMN diagram. Swimliny are a bit unreadable :-/ so from the top: BPEL, WS External, Fault Management Framework and Java Class.
Java Java class that will be called policy must implement rohraní IFaultRecoveryJavaClass. kent beverage It has two methods, we are interested only HandleFault that has as parameter IFaultRecoveryContext. Use of this context can access objects in the BPEL process, where skyrocketed exception. From the context, so pull out the above BPEL variable SoapFault and using XPath or DOM it is filled. At the end of the return string methods rethrow policy to return control back to the BPEL process from where it is then returned SOAP fault to the client. (Sorry to mention all the code. But if it happened to someone (in Czech) address, so make it a little easier :-) cz.swsamuraj.soa.fault package; import com.collaxa.cube.engine.fp.BPELFaultRecoveryContextImpl; import oracle.integration.platform.faultpolicy.IFaultRecoveryContext; import oracle.integration.platform.faultpolicy.IFaultRecoveryJavaClass; kent beverage import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; / *** This class is Called by fault policy. Its purpose is to set up a variable * Which is then Throwed as a SOAP fault. Guido ** @ author * / public class implements SOAPFaultHandler IFaultRecoveryJavaClass {private static final String VARIABLE = "SoapFault"; private static final String PART = "payload"; private static final String RESULT_CODE_NAME = "ResultCode"; private static final String RESULT_CODE_VALUE = "255";

No comments:

Post a Comment