Wednesday, April 9, 2014

In this post, I will show you how to do error handling in Oracle Service Bus. To show this we have prepared a use case, in this use case we call SOA web service from Oracle Service Bus. But we shut down the SOA service to generate the error so when Oracle Service Bus try to call SOA service it will get error out and we will handle that fault in Oracle Service Bus. In the Oracle Service Bus error handling once we receive the fault message, we will send that fault message to JMS queue.



To send message to JMS queue, we will use re-use the business service that we created in previous post.

First Create an OSB project. Create three folders under project.




Load SOA service WSDL & XSD file to resource folder of newly created OSB project.






Create a Business service which will call SOA service. To create it click on business folder and choose “Business Service” from resource type drop- down.

Name your Business Service and browse WSDL file of SOA web service.





Choose WSDL binding and click on submit.





Set the EndpointURI for SOA service.




Accept defaults and save your business service.

Now we will create proxy service which invokes newly created business service. To create proxy services click on proxy folder and choose “Proxy Service” from resource type drop-down.

Name your proxy service and browse newly created business service.





Accept default and save your proxy service.

Now we will add error handling to Proxy service to handle fault generated when we call SOA service.

To add error handling, go to message flow of proxy service. Click on route node and click on “Add Route Error Handler”.




Once you add route error handler, right-click to add the stage. Name the stage activity. Click on Edit Stage to add required activities inside error handler.





Inside stage activity click on “Add an Action” and add “Publish” activity which will call JMS queue business service which send the message to JMS queue.




Now we need to pass fault message to business service that we have configured inside publish activity. For that add “Replace” activity. Now whatever you want to pass to JMS queue you can choose from fault variable.





We will assign fault message to body variable of business service.





Add reply activity after the publish activity.

Click on validate and save the flow. Activate the session.

Testing Result

We have shut down the SOA service so that we get fault when OSB try to call it.



Now test the proxy service. When you test the proxy service you will see error message.




Now to check whether OSB error handler is working or not, go to JMS queue and check the message.


5 comments :

  1. Hello Vivek,

    Your blog is very helpful. I really appreciate you for sharing your knowledge. I have a question to ask. How do we handle the exceptions in ejb on osb when we use ejb protocol in business service?

    ReplyDelete
    Replies
    1. I haven't work on ejb yet, I will work on it and let you know.

      Vivek

      Delete
  2. Hi Vivek , i'm following your blog regularly it's really awesome one and you provided very good information regarding SOA,Sir can you please provide a examples on common error handling for more than two interfaces and as well as,in 12c we have a new adapter called E-Business suite if you provide examples on that adapter that would very helpful for us. Thank you.

    ReplyDelete