120 likes | 249 Vues
This document outlines the fundamental aspects of fault handling within Business Process Execution Language (BPEL) processes. It covers the various types of faults, including business faults resulting from application-specific issues and technical faults stemming from system errors. The text delves into mechanisms for throwing and catching faults, providing guidance on how BPEL components manage error messages and exceptions from external web services. A detailed discussion of fault types, their occurrence scenarios, and examples of fault definitions in WSDL is included to equip developers with practical insights for implementing robust error handling strategies.
E N D
Fault Handling • Activities covered: • Scope • Throw • Catch • Sensor
Fault • Fault is an disturbance occurred during the happy path execution of a process which result in a signal being sent from the system. • Disturbance can for various reason like • Technical Error • Programming Error • Faulty Operation by Client • Exceptional business behavior • Fault Handling allows a BPEL process service component to handle error messages or other exceptions returned by outside web services, and to generate error messages in response to business or runtime faults. • You can also define a fault management framework to catch faults and perform user-specified actions defined in a fault policy file.
Fault Types • Business Faults: Fault generated in business scenario’s. • 1. From Partner Link • 2. From Process • Technical Faults: Faults generated from system • 1. Standard Faults • 2. Runtime Faults • - Binding Fault • - Remote Fault
Business Fault • Business faults are application-specific faults that are generated when there is a problem with the information being processed (for example, when a social security number is not found in the database). • A business fault occurs when an application executes a throw activity or when an invoke activity receives a fault as a response. The fault name of a business fault is specified by the BPEL process service component • The messageType, if applicable, is defined in the WSDL. A business fault can be caught with a faultHandler using the faultName and a faultVariable. • <catch faultName="ns1:faultName" faultVariable="varName">
Cont… <wsdl:operation name="orderProduct"> <wsdl:input message="order:OrderProductRequestMessage"/> <wsdl:output message="order:OrderProductResponseMessage"/> <wsdl:fault message="order:ProductNotInStockFaultMessage" name="ProductNotInStockFault"/> <wsdl:fault message="order:CustomerNotFoundFaultMessage" name="CustomerNotFoundFault"/> </wsdl:operation> <xsd:element name="CustomerNotFoundFaultMessage"> <xsd:complexType> <xsd:sequence> <xsd:element name="CustName" type="xsd:string"/> <xsd:element name="City" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> 1.Service contract including fault 2. Fault message payload
Cont… <soap:Envelope> <soap:Header/> <soap:Body> <soap:Fault> <faultcode>CST-1234</faultcode> <faultstring>Customer not found</faultstring> <detail> <CustomerNotFoundFault> <CustName>John Doe</CustName> <City>Long Beach</City> </CustomerNotFoundFault> </detail> </soap:Fault> </soap:Body> </soap:Envelope> 3Actual service response
Technical Fault – Standard fault • Standard Faults: Are the faults that directly from BPEL Specification. • BPEL4WS specification defines the following standard faults in the namespace of http://schemas.xmlsoap.org/ws/2003/03/business-process/ • Standard faults are defined as follows: • Typeless, meaning they do not have associated messageTypes • Not associated with any Web Services Description Language (WSDL) message • Caught without a fault variable • <catch faultName="bpws:selectionFailure">
Cont… • bindingFault and remoteFault(BPEL extension fault defined in http://schemas.oracle.com/bpel/extension) • conflictingReceive • conflictingRequest • correlationViolation • forcedTermination • invalidReply • joinFailure • mismatchedAssignmentFailure • repeatedCompensation • ambiguousReceive • completionConditionFailure • invalidBranchCondition • invalidExpressionValue • invalidVariables • missingReply • missingRequest • scopeInitializationFailure • selectionFailure • uninitializedPartnerRole • uninitializedVariable • unsupportedReference • xsltInvalidSource • xsltStylesheetNotFound
Technical Fault – Runtime Fault • Runtime Faults: • - Runtime faults are the result of problems within the running of the BPEL component. • Runtime faults are not user-defined, and are thrown by the system. We need to define parts in the process to handle them. • Are generated if the process tries to use a value incorrectly, a logic error occurs (such as an endless loop), a Simple Object Access Protocol (SOAP) fault occurs in a SOAP call, an exception is thrown by the server, and so on • In BPEL we will use catch activity to handle them. <soap:Body> <soap:Fault> <faultcode>S:Server</faultcode> <faultstring>Could not connect to URL 127.0.0.1 on port 8001</faultstring> </soap:Fault> </soap:Body> Actual service response
Cont… Binding Fault Binding Fault A binding fault is thrown inside an activity if the preparation of the invocation fails. A bindingFault is not retryable. This type of fault usually must be fixed by human intervention. Eg: the WSDL of the process fails to load.
Cont… Remote Fault 2. Remote Fault A remoteFault is also thrown inside an activity. A remoteFault can be configured to be retried Thrown because the invocation fails. Eg: SOAP fault is returned by the remote service.