Monday, December 9, 2013

Setting A Timeout For A Web Service in SOA Suite 11g


This post explains how to set a TIMEOUT for a  Web Service invocation when using SOA 11g .

This applies to both BPEL and Mediator and can be used when only the Web Service invocation is made through HTTP. 


1. For a process that invokes a Web Service, we want to set a timeout of maximum 10 seconds that the SOA application will wait for the answer. If no response is received within the specified timeout, then we want to catch the timeout error and perform a series of other activities.

The sample below is for a BPEL in a SOA Composite - it will work the same way with Mediator as the timeout is set in composite.xml file and not in some specific BPEL file .

2. Let's say the SOA composite looks like this:

3. Click on  "Service1" and note that the property inspector will open in the lower right side of your JDeveloper window. Here set the property :

oracle.webservices.httpReadTimeout = 10000

If the Web Service is on the same domain as the SOA Composite , we need have to set 

oracle.webservices.local.optimization = false

By default the local optimization is TRUE and when a SOA composite invokes another SOA composite within the same Weblogic (WLS) server or cluster of WLS servers bypasses the whole SOAP stack, and makes a direct java call to optimize the invocation.

You may set these properties directly in composite.xml as follows :

4. In the BPEL process we can add a Catch branch for a RemoteFault if wewant to catch this error . 

5. Now deploy the composite and run it from EM page . The Web Service we are calling takes 30 seconds to complete , but we set the timeout to 10 seconds - note that the Remote Fault occurs after 10 seconds.

6. Other way is the BPEL only, it's possible to use "Timeout" option for Invoke or Receive activities.Note when using this parameter it will return a "bpelx:timeout" Fault, and not a Remote Fault

No comments:

Post a Comment