cancel
Showing results for 
Search instead for 
Did you mean: 

JAX WS Timeout property?

Former Member
0 Kudos

Hi,

I am calling PI webservices in my Web Dynpro application, using the standalone proxy approach in NWDI CE 7.1 enhancement pack 1. I think that JAX WS 2.0 is the version that is being used for these proxies.

So far, I have been able to create the proxy, call the webservice and get the data that I need. But sometimes, the webservice takes more than 1 minute to execute and I get the 'java.net.SocketTimeoutException' exception. I need to be able to set the socket timeout to atleast 3 minutes (that is the timeout set for our PI service calls).

After reading various blogs for the same issue, I have tried the following, but without success:

1)

((BindingProvider) serviceObject).getRequestContext().put("com.sun.xml.ws.request.timeout", 180000);

((BindingProvider) serviceObject).getRequestContext().put("com.sun.xml.ws.connect.timeout", 180000);

2)

((BindingProvider) serviceObject).getRequestContext().put("com.sun.xml.ws.request.timeout", new Integer(180000));

((BindingProvider) serviceObject).getRequestContext().put("com.sun.xml.ws.connect.timeout", new Integer(180000));

3)

((BindingProvider) serviceObject).getRequestContext().put("com.sun.xml.ws.request.timeout", "180000");

((BindingProvider) serviceObject).getRequestContext().put("com.sun.xml.ws.connect.timeout", "180000");

4)

((BindingProvider) serviceObject).getRequestContext().put("com.sun.xml.internal.ws.request.timeout", 180000);

5)

((BindingProvider) serviceObject).getRequestContext().put("com.sun.xml.internal.ws.request.timeout", new Integer(180000));

6)

((BindingProvider) serviceObject).getRequestContext().put("com.sun.xml.internal.ws.request.timeout", "180000");

I still get the socket time out exception after 60 seconds, which seems to be the default.

Is there any other approach that worked for you? Is there something that I am missing? This is a show stopper, so I would really appreciate any help!

Thanks & regards,

Navneet.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I finally got it solved using the HTTPControlInterface object.

Thanks to the following blogs:

http://wiki.sdn.sap.com/wiki/display/WDJava/FAQ%2b-%2bModels%2b-%2bAdaptive%2bWeb%2bService

My theory was that the Adaptive Webservice model and the webservice proxy that I am using should be able to use the same set of APIs to customize properties such as the time out and endpoint.

Anyways these are the steps to be followed to programatically set the socket time out:

1) Add DC dependencies for

- tc/bi/wstech

- tc/bl/wsproxy/standalone

- tc/wd/wslib/api (if you are using an adaptive webservice model)

- webservices

- webservices_lib

2) Instead of the code that i mentioned previously, just use the following lines of code:

// Code to override the default socket time out of the server.

HTTPControlInterface httpItf = HTTPControlFactory.getInterface(serviceObject);

httpItf.setSocketTimeout(180000); // socket time out in millis. (long datatype)

Edited by: Navneet Nair on Mar 31, 2010 4:24 PM

Edited by: Navneet Nair on Mar 31, 2010 4:35 PM

Former Member
0 Kudos

In case you are not using the BindingProvider object to set the endpoint, username and password, the same HTTPControlInterface object also exposes methods such as:

1) httpItf.setEndpointURL(strEndpoint)

2) httpItf.setHTTPProxyUserPass (strUsername, strPassword). [this method was giving me a 401 unauthorized error, so I stuck to the BindingProvider to set the username and password, and set the timeout after that]

- Navneet.