1. Business faults 和Runtime faults
BPEL 异常通常由异常名称(name qualified with a namespace)和异常的信息类型messageType构成。和大多数应用一样,BPEL 把异常分为两种以区别对待:
- Business faults
- Runtime faults 或 system faults
3. Runtime faults
Runtime faults 是与BPEL运行时相关的错误,由系统抛出,不可预见,比如变量无法找到、死循环错误、SOAP调用时发生SOAP fault、BPEL Server抛出的Java异常。Runtime faults 分为以下几种:
- Standard faults
- remoteFault
- bindingFault
- replayFault
<?xml version="1.0" encoding="UTF-8" ?>
<definitions name="RuntimeFault"
targetNamespace="http://schemas.oracle.com/bpel/extension"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="RuntimeFaultMessage">
<part name="code" type="xsd:string" />
<part name="summary" type="xsd:string" />
<part name="detail" type="xsd:string" />
</message>
</definitions>
3.1 Standard faults
Standard faults的特点如下:
- 无信息类型messageTypes定义
- 与任何WSDL message 无关
- 捕捉时不需要指定变量名称:<catch faultName="bpws:selectionFault">
(1)selectionFailure
(2)conflictingReceive
(3)conflictingRequest
(4)mismatchedAssignmentFailure
(5)joinFailure
(6)forcedTermination
(7)correlationViolation
(8)uninitializedVariable
(9)repeatedCompensation
(10)invalidReply
3.2 remoteFault
remoteFault 是调用服务的阶段抛出的异常,比如 SOAP调用时抛出SOAP fault。
remoteFault 可以重试。
remoteFault 细分为以下几种错误:
(1)ConnectionRefused Remote server is unavailable
(2)WSDLReadingError Failed to read the WSDL
(3)GenericRemoteFault Generic remote fault
3.3 bindingFault
bindingFault 是在准备调用服务的阶段抛出的异常,比如 WSDL无法装载。bindingFault 不能重试。
出现bindingFault后,必须要人工干预来修正错误。
bindingFault 细分为以下几种错误:
(1)VersionMismatch The processing party found an invalid namespace for the SOAP envelope element.
(2)MustUnderstand An immediate child element of the SOAP header element that was either not understood or not obeyed by the processing party contained a SOAP MustUnderstand attribute with a value of 1.
(3)Client.GenericError Generic error on the client side
(4)Client.WrongNumberOfInputParts Input message part number mismatch
(5)Client.WrongNumberOfOutputParts Output message part number mismatch
(6)Client.WrongTypeOfInputPart Input message part type error
(7)Client.WrongTypeOfOutputPart Output message part type error
(8)Server.GenericError Generic error on the server side
(9)Server.NoService Server is up, but there is no service
(10)Server.NoHTTPSOAPAction Request is missing the HTTP SOAP action
(11)Server.Unauthenticated Request is not authenticated
(12)Server.Unauthorized Request is not authorized
3.4 replayFault
A replayFault replays the activity inside a scope.
At any point inside a scope, this fault is migrated up to the scope.
Oracle BPEL Server then re-executes the scope from the beginning.
4. 如何返回错误给客户端?
4.1 同步调用<reply partnerLink="Client" portType="buy:BuyBookPT" operation="BuyBook" variable="FaultDetails" faultName="fault" />
4.2 异步调用
<invoke partnerLink="Client" portType="buy:ClientCallbackPT" operation="ClientCallbackFault" inputVariable="FaultDetails" />
没有评论:
发表评论