Tuesday, February 08, 2011

OSB: Creating A-Synchronous / Fire-Forget WebService Call

Out of the box, the Oracle Service Bus (OSB) is is handling synchronous services. If you want to make services, a-synchronously, you should add queues (JMS / AQ / DB) in front or behind it. Or use a SOA 11g / BPEL solution.

When you want to create a fire-forget call via OSB, is rather simple. The trick is to send NO response back to the caller, only an HTTP reponse code; 200 or any other.

You could do this by creating a Proxy service. In this Proxy service you create your pipe-line. In the request of the pipe-line you add the stage and other activities to prepare the data to send to your service. This is done by using the publish activity.

The you create a empty routing activity (!). This does the trick. You you can force in the reponse pipe-line the HTTP response code.

The RouteNode1 activity is dummy and empty. In the request pipeline the service is called, via the publish activity.

The Insert Activity, in the stage of the response pipeline, is overriding the HTTP response code in the inbound variable via the XPath query.
<http:http-response-code>202</http:http-response-code>

as last child of:

./ctx:transport/ctx:response

in 'Inbound' variable.

You can use this solution also as an entry for a-Synchronous web-service call.

Thanks to Fai Fung, when helping me on performance testing on the 4-node OSB Cluster.

Post a Comment