Recently, I worked on a project and need to handle webservice call time-out issue. In current solution, the developers used JMS Queue to handle the time-out issue. The flow can be described as the following steps.
- When our webservice gets a request from client, the message will be put in the request queue
- a MDB picks the message and initializes an webservice call to an scheduling system to make an appointment
- After the MDB gets the response, it puts the response message into response queue.
- The caller process picks up the message and returns to client.
Now, we prepared to move the application from WLI to SOA Suite and were asked to handle the same issue in SOA Suite. What I thought is there are 2 approaches to do it.
- Implement the exact same logic with BPEL and JMS Queue.
- Implement a much smarter process to return the response to client utilizing the BPEL correlation.
I did some research on the internet and didn't get a happy answer on how to implement second solution. But theoretically, I thought BPEL should be able to complete this job as it is statful and supports long run transaction. I didn't give up and kept to look for any sample I could find on the internet and books. Eventually, I found some helpful information from Oracle SOA Suite 11g Developers Cookbook and a blog on AMIS Technology Blog, which are listed in the references. Based on these pieces information, I began my adventure.
At the beginning, I just followed the book as the book mentioned the correlation implementation is different from SOA Suite 220.127.116.11 and didn't looked at the log in detail. I copied the schema and wsdl from the sample code of Oracle SOA Suite 11g Developers Cookbook, then modified them to add an response for the service. But the code didn't work when I completed and it could not accept any further call with the OnMessage activity.
Later, I began to look at the blog line by line and tried to find useful information. Fortunately, it is really helpful and I found I need to add correlation on the response too. After that, it still didn't work. Then I added an reply before the invocation of third part webservice. Woo! What a magic it is. it worked eventually.
Use BPEL Correlation Sets for repeated (synchronous) access to long running BPEL processes
Chapter 5 of Oracle SOA Suite 11g Developers Cookbook (P96)