1

I'm developing Jax-ws client on Jboss 5.1.0 GA. I want to set web service client timeout.

I've tried StubExt.PROPERTY_CLIENT_TIMEOUT.

int timeoutMillisecond=3000; bp.getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, timeoutMillisecond); 

It works but exception is thrown only after 3*timeoutMillisecond (after 9000 millisecond), but 3000ms is written in log file.

2012-12-24 15:42:40,053 DEBUG Sending request 2012-12-24 15:42:49,057 ERROR WebServiceException returned: javax.xml.ws.WebServiceException: org.jboss.ws.core.WSTimeoutException: Timeout after: 3000ms 

I've rtied also many other ways

bp.getRequestContext().put("com.sun.xml.ws.connect.timeout", 100); bp.getRequestContext().put("com.sun.xml.ws.request.timeout", 100); // from com.sun.xml.ws.developer.JAXWSProperties bp.getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT, 100); bp.getRequestContext().put(JAXWSProperties.REQUEST_TIMEOUT, 100); 

But nothing worked on Jboss 5.1


Could you tell me how to set client timeout correctly ?

1

3 Answers 3

1

I did the following steps and fixed the problem:

  1. Upgraded jbossws-native library, follow this link.
    jbossws-native-3.4.0 is the latest supported version for Jboss 5.1.0GA. You can see JBossWS - Supported Target Containers

  2. Used StubExt.PROPERTY_CLIENT_TIMEOUT

    int timeoutMillisecond=3000; bp.getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, timeoutMillisecond); 

By the way, in this version StubExt.PROPERTY_CONNECTION_TIMEOUT also works correctly.

Sign up to request clarification or add additional context in comments.

Comments

0

You can use these settings for your service port.

BindingProvider bindingProvider = (BindingProvider) YOUR_SERVICE_PORT; Map<String, Object> context = bindingProvider.getRequestContext(); context.put(BindingProviderProperties.CONNECT_TIMEOUT, 3*1000); context.put(BindingProviderProperties.REQUEST_TIMEOUT,3*1000); 

1 Comment

BindingProviderProperties.REQUEST_TIMEOUT is the variable name for "com.sun.xml.ws.request.timeout" and BindingProviderProperties.CONNECT_TIMEOUT for "com.sun.xml.ws.connect.timeout" which the OP has already tried and it didnt work.
0

you're complete missing the point check out code:

URL url = new URL("http://tst.com:9990/ws/hello?wsdl");

 //1st argument service URI, refer to wsdl document above //2nd argument is service name, refer to wsdl document above QName qname = new QName("http://tstsoap/", "HelloWorldImplService"); Service service = Service.create(url, qname); HelloWorld hello = service.getPort(HelloWorld.class); 

As you can see, you cannot get a port without creating a service first.
So the timeout always occurs at the service creation. So setting a time for the port is pointless....... Somebody needs to post something about service timeouts....not port timeouts.... Unless somebody can prove me wrong....

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.