File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Timeout Exception while connecting to a web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Timeout Exception while connecting to a web service" Watch "Timeout Exception while connecting to a web service" New topic
Author

Timeout Exception while connecting to a web service

Jitesh Sinha
Ranch Hand

Joined: Jun 19, 2004
Posts: 146
Hi All,

We have a client code that connects to a web service written by some other group.Recently we have started getting a lot of Timeout exception while trying to invoke one of service side methods.Our call waits for 2 minutes and times out.When I contacted service side developer,he told me to explicitly set timeout on client side.
So I searched on web and found this -

((BindingProvider)port).getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT, 300);
((BindingProvider)port).getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, 300);

After putting these two lines,I get SocketTimeOutException(Different from earlier Timeout exception) almost instantly.
Can someone please help?

Thanks.

H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
    
    4
Try Asynchronous Client
http://jax-ws.java.net/nonav/2.1.4/docs/asynch.html
Jitesh Sinha
Ranch Hand

Joined: Jun 19, 2004
Posts: 146
That is an option when nothing else works.
What is puzzling is that this call has been working fine for almost 3 years now.Just this month it started throwing out this error.
Here is the stack trace -

javax.xml.ws.soap.SOAPFaultException: Timeout
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP1
1Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPF
aultBuilder.java:119)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMeth
odHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMeth
odHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy32.importDocument(Unknown Source)
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
    
    4
There is no cause without an effect. And there is no effect without a cause.

Hypothetical questions:

1. Is there any changes in the network infrastructure?
2. If the code worked so far, then why it worked in the first place?
May be not all use cases were covered under certain conditions on the server side? on the client side or both end.
3. Suppose the client and server covered all cases and are perfect, then what is left? Network issue? Any thing on the server side that could affect the outcome?
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
    
    4
Is that 300 milliseconds?

Jitesh Sinha
Ranch Hand

Joined: Jun 19, 2004
Posts: 146
That is 300 seconds.
I do not have any control over server side.I have been talking to those people who are responsible for it- but they say everything is fine on their side.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
    
    4
0. For now, do not set the timeout on the client side.

1. Check the server side log. Ask the provider have a check.
There might be log on the web container side or server side. That might give some clue.

2. Number checking:

I do not know the technical environment of your specific situation. So are Hypothetical questions:

Imagined Process Flow:
Client --- Server side ---Use JMS --- Use Database

Under normal condition, every thing is OK. Meaning the app was designed for a certain N concurrent requests withing a certain time frame.
It might work, three year ago but not now due to growth of work load N+M concurrent requests.

If during the process, if Database or JMS or Web container can not handle N+M concurrent users then Client is in trouble.

For web container, check number of concurrent thread it can handle.
For Database, number of concurrent connection, was there any deadlock.
For JMS, if the queue is full.

If none of these has any issue, then consider review the whole process flow again - client + server or do some bandage.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Timeout Exception while connecting to a web service