Databases Reference
In-Depth Information
Handling faults in synchronous proxy services
The basic strategy for handling faults within the Service Bus is essentially the same
regardless of whether it is a business or system fault. That is to catch the fault, undo
any partially completed activities so that we leave the system in a consistent state,
and map the underlying fault to a standard fault, which is then returned to the client.
If we examine the CreditCard service used by the previous BPEL process, this is
actually a proxy service implemented on the Service Bus. OBay accepts MasterCard
and Visa, and in our scenario, each of these card providers offers its own service for
card verification and payment processing.
The role of the CreditCard proxy is to provide a standardized service, independent
of card type. It will then route requests to the appropriate service, based on the card
being used.
As part of this process, the proxy service will transform the request from the oBay
canonical form into the specific format required by the card provider and vice versa
for the response.
If, during execution of the proxy service, an error occurs, the role of the proxy service
is to intercept the fault and then map it to a specific type of fault, either a business
fault defined by the proxy service or a standard system fault.
Raising an error
When an error occurs, the Service Bus performs a number of steps. First, it will
populate the $fault variable with details of the error. Next, if the error was caused
by the external service returning a fault, it will update the $body variable to hold the
actual fault returned.
For example, if the verifyMasterCard operation returned the following fault:
<env:Bodyxmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Faultxmlns:mcd="http://xmlns.packtpub.com/MasterCard">
<faultcode>mcd:invalidMasterCard</faultcode>
<faultstring>businessexception</faultstring>
<faultactor>cx-fault-actor</faultactor>
<detail>
<declinedxmlns="http://xmlns.packtpub.com/MasterCard">
<code>STOLEN</code>
<desc>Cardreportedstolen.</desc>
</declined>
</detail>
</env:Fault>
</env:Body>
 
Search WWH ::




Custom Search