File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Setting time out for web service call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Setting time out for web service call" Watch "Setting time out for web service call" New topic

Setting time out for web service call

rishimi mishiri

Joined: Jan 31, 2010
Posts: 2
In our application, I am using webservice client generated from a wsdl provided by other web service application vendor. Sometimes calls to the webservice keeps on waiting for connection, may be due to network problem or webservice is down. Can anybody tell me how to set time out value so that it can close the connection if it could not get in certain time. Is this possible at the client side code or do we need modify wsdl in order to set this or is there any other way to achieve this?
Chethan Verma

Joined: Oct 30, 2006
Posts: 18

Is your client a JAX-RPC or JAX-WS client?

You can set timeout on JAX-RPC clients using setTimeout(int timeout) method on the Stub.

For JAX-WS clients also you can set timeout using BindingProvider, but for some reason it is not working with Websphere 6.1
shaz washere

Joined: Aug 19, 2011
Posts: 2
I'm seeing a similar problem in my application.

I'm using JAX-RPC with websphere v6.1. I've tried too many configurations and code snippets to set the TimeOut value.

1) (Stub) myStub.setTimeOut(20*000)
2)Configuring the ibm-webservicesclinet-bnd.xmi deployment descriptor

But nothing seems to work.
With the timeout set to 20 seconds,when the webservice provider is unavailable, application takes over 5 mins to come back with a General Exception, but since our Total transaction TimeOut (in the WAS console) is only 120 secs, the applications sees a Timeout exception and Rollback is performed. The Network team analyzed the issue and said our Client is creating multiple request to the provider which could be the reason why it takes more than the TimeOut value to return.

I did come across this article by IBM and feel it could be my issue although i'm not using SSL as IBM reports:

IBM doesnt mention any temporary fixes for this, can anybody help me limit the number of attempts ot the total time of all attempts ?? so that my app works fine.

I agree. Here's the link:
subject: Setting time out for web service call
It's not a secret anymore!