web analytics
free online training

Fault Management in Oracle Service Bus

I received queries from some of the readers on ’s fault handling behaviour recently. I thought best way to explain would be through an example and here we go …

image

Above example, deals with two look up services: Airport and Currency. These would be installed in BPEL as SOAP services. Oracle Service Bus will then invoke these services with the help of appropriate business services and a common . If either currency or airport code is not found, BPEL webservices will throw InvalidCurrencyFault and InvalidAirportFault respectively. These Faults are captured at OSB’s proxy stage with the help of Error Handler defined at “Route Node” stage. OSB then transforms these faults into appropriate common faults and sends response back to the client. For more details on Routing and Transformation in OSB, please refer to this example.

Let us look at each step in detail.

Step 0: Client invokes Common Lookup Proxy Service available from OSB.

  1. Common Lookup Proxy Service, with the help of a Routing Table, invokes Airport Lookup .
  2. Common Lookup Proxy Service, with the help of a Routing Table, invokes Currency Lookup Business Service.
  3. Airport Lookup Business Service will invoke corresponding lookup service hosted in BPEL.
  4. Currency Lookup Business Service will invoke corresponding lookup service hosted in BPEL.
  5. BPEL throws InvalidAirportFault when the airport code is not found. In this case, only ‘LHR’ is recognized.
  6. BPEL throws InvalidCurrencyFault when the currency code is not found. In this case, only ‘GBP’ is supported.
  7. Error Handler defined at “Route Node” stage of the proxy service will catch InvalidAirportFault exception and transforms into CommonLookupAirportFault.
  8. Error Handler defined at “Route Node” stage of the proxy service will catch InvalidCurrencyFault exception and transforms into CommonLookupCurrencyFault.

Step 9: Client receives CommonLookupAirportFault & CommonLookupCurrencyFault from OSB.

Steps to install and test the Example:

  • Download BPEL Lookup Service composite and install. This composite also includes a Mediator component, just to demonstrate similar exception handling can also be done in Composite. LookupMediator also transforms BPEL business faults into Common Faults. However, AirportLookupService and CurrencyLookupService can also be independently invoked and tested as webservices. Complete JDeveloper project is available from here.

image

Test BPEL Lookup Services:

  • Ensure this service has three end points: currencylookupservice_client_ep, LookupMeditator_ep and airportlookupservice_client_ep.

image 

  • Click on currencylookupservice_client_ep from Test menu as shown above.
  • Enter code=GBP and value=GBP and hit Test Web Service.

image

  • Ensure output is British Pound.

image

  • Test lookup service for code=INR and value=INR. This should result into InvalidCurrency exception as shown below.

image

  • Similarly, airportlookupservice_client_ep should pass successfully for code=LHR, value=LHR, but should fail for code=BLR, value=BLR.

image

Install OSB Lookup Service:

  • Download OSB Lookup Service and save to your local folder. Login to OSB console, go to “System Administration-> Import Resources”and select osb_LookupService_1.0.jar from previous folder. Click Next.

image

  • Click on Import to import the OSBLookupService project.
  • From project explorer navigate to OSBLookupService->business folder. Edit AirportLookupBS and CurrencyLookupBS to modify endpoints of match your BPEL server’s name and port number. For example, default end points look like:

image 

image

  • Given below is the snapshot of OSB Lookup Service, taken from Weblogic Workshop, that shows Proxy Service, Routing Table, Error Handler etc.,

OSB Fault Management

Test OSB Lookup Service:

  • Navigate from Project Explorer to OSBLookupService->proxy folder. Click on Launch Test Console for CommonLookupProxy.

image

  • Enter following XML in payload and hit on Execute-Save.

<ebm:lookupRequest xmlns:ebm="http://www.orafmwschool.com/training/lookup/common/ebm">
    <ebm:type>AIRPORT</ebm:type>
    <ebm:code>LHR</ebm:code>
</ebm:lookupRequest>

  • London Heathrow will be populated in response.

image

  • Now, try an invalid AIPORT lookup code to see CommonAirportLookupFault. Enter following payload and hit on Execute-Save.

<ebm:lookupRequest xmlns:ebm="http://www.orafmwschool.com/training/lookup/common/ebm">
    <ebm:type>AIRPORT</ebm:type>
    <ebm:code>BLR</ebm:code>
</ebm:lookupRequest>

image

  • Observe BPEL log messages from server console.

bpelfault

  • Similarly try following two payloads and observe the output and fault messages.

<ebm:lookupRequest xmlns:ebm="http://www.orafmwschool.com/training/lookup/common/ebm">
    <ebm:type>CURRENCY</ebm:type>
    <ebm:code>GBP</ebm:code>
</ebm:lookupRequest>

<ebm:lookupRequest xmlns:ebm="http://www.orafmwschool.com/training/lookup/common/ebm">
    <ebm:type>CURRENCY</ebm:type>
    <ebm:code>INR</ebm:code>
</ebm:lookupRequest>

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Related posts

3 Comments
  1. Hi Amjad,

    How does this example change if the two bpel processes are ASYNCHRONOUS instead of SYNCHRONOUS. We have a requirement of an ASYNCHRONOUS mediator connected to an ASYNCHRONOUS bpel process and ASYNCHRONOUS bpel process is throwing faults. Can we handle these faults in the mediator routing rules and how?

    Regards.

    VA:F [1.9.17_1161]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.17_1161]
    Rating: 0 (from 0 votes)
    • Asynchronous fault is equivalent to an asynchronous response call back. You can create routing rule in Mediator to capture this asynchronous fault. We can create an example demonstrating this use-case. Please look at our support services if you are interested.
      http://www.orafmwschool.com/training/#support

      VN:F [1.9.17_1161]
      Rating: 0.0/5 (0 votes cast)
      VN:F [1.9.17_1161]
      Rating: 0 (from 0 votes)
      • Thank you ADMIN,

        I have modified the wsdl file and added an operation for the fault in the CallBack portType and it looks fine, so there shall be two responses back from the bpel service one based on normal response and the other based on a fault. However in asynchronous based mediator, there is no way of creating an additional callback response. For synchronous based mediator, there is a way of creating an additional fault in the routing rule.

        Thanks.

        VA:F [1.9.17_1161]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.17_1161]
        Rating: 0 (from 0 votes)
Leave a Reply