Sunday, March 28, 2010

How to set timeout for JAX-WS client invocations programmatically in WebSphere

A few of my teammates find it difficult to get this working properly. I hope this write-up and example code below would help you. It's actually not too hard.

What can I adjust?

There are three timeouts you can set:

1. CONNECTION_TIMEOUT: The amount of time WebSphere JAX-WS client would wait to establish a http/https connection (default is 180 seconds)
2. WRITE_TIMEOUT: The amount of time the client would wait to finish sending the request (default is 300 seconds)
3. RESPONSE_TIMEOUT: The amount of time the client would wait to finish receiving the response (default is 300 seconds)

How can I set them in my application code?

You can adjust them by setting properties on the requestContext. See code sample below.

HelloWorldSOAPProxy proxy = new HelloWorldSOAPProxy(); // generated proxy class

Map requestContext = ((BindingProvider)proxy._getDescriptor().getProxy()).getRequestContext();
requestContext.put( , "1");
requestContext.put( , "2");
requestContext.put( , "40");


Note: The property value in the Map must be a String; and in seconds.

My code does not work in my environment. How do I troubleshoot it?

Use the WebSphere AdminConsole to enable this trace specification (on the client side): "*=all=enabled:org.apache.axis2.*=all=enabled"

You should see something like this in the trace (if you set the response timeout).

[04/08/2009 19:28:37:937 EDT] 00000000 > prepareHttpRequestHeaders(): Entry
[04/08/2009 19:28:37:953 EDT] 00000000 3 ...ConfigFromJAX_WS.getReadTimeout() : 40
[04/08/2009 19:28:37:953 EDT] 00000000 3 syncTimeoutValue 40000 ms for http

Additional tip:

If you are using a standalone Java client (outside of the J2EE container), you can set the WebSphere traceSpec using system properties.


and put your traceSpec in a file (e.g. on the working directory.


What if I can't or don't want to change the application code?

You can configure the HTTP Transport Policy to adjust these timeouts. See link in InfoCentre for details.

That's all for now.


  1. If you lend someone $20 and never see that person again, it was probably worth it.............................................

  2. 任何你憂慮的事,你都應該去採取一點行動,不要只是在那邊想..................................................

  3. Hi,

    I noticed that to set the JAXWS connection timeout, for instance, one could define the HTTP Transport Policy in the Policy Set of the set the timeout.
    But, I have a WS-Security Policy in my Policy Set and adding a HTTP Transport Policy seems to upset the application( get some exceptions and app does not work ).
    Any other suggestions ?

  4. Wow what a nice post.I like it.

    Thanks for more sharing..........


  5. Siebel SmartScript accelerates abettor capability with a workflow-based, dynamically generated user interface that helps adviser every alternation with a customer. Siebel SmartScript can be invoked automatically several ways, such as based aloft business rules, through awning pops, by Siebel CTI, or programmatically.

    call center outsourcing

  6. Hi
    Its a nice piece of information, it will really helpful for the people who are planning to invest in transport business.Generally people face lot of problems while shifting their home or office. Its really a difficult task.For all those who hate wasting time in shifting, man and van is for you.They provide you man and van services for shifting in all over UK.

  7. Thanks for sharing fabulous information. It' s my pleasure to read it.I have also bookmarked you for checking out new posts. by ACC 290 Final Exam

  8. I had a great time reading around your post as I read it extensively. Excellent writing! I am looking forward to hearing more from you.web hosting companies | best hosting companies