We have implemented a JAX-WS client and facing the following issue. It is a stateful session sync flow. The client makes two requests/response initially one by one sucessfully
3 different Cases for the issue
1) After the first two request/response, I am making a third request which is after 6th and 9th( two different test cases) seconds after the receiving the response of 2nd request. In both the cases, from the tcpdump I could see that our client is closing the existing tcp connection by [FIN,ACK] and opening a new connection for the 3rd request. But since this is stateful session, the server expects the connection should not be cloased and so we are getting error response.
2) If I make the 3rd request within 5 seconds after 2nd request, then the same tcp connection is re-used.
3) If I dont make 3rd request at all, then automatcially after 10 seconds(by [FIN,ACK] from the 2nd request, the tcp conenction is closed by the client.
Basically the problem is client application is closing the tcp connection by itself. I have tried by setting all the following properties. But still I am facing the same problem.
BindingProvider bp = (BindingProvider)port;
Map<String, Object> context = bp.getRequestContext();
context.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
context.put(JAXWSProperties.CONNECT_TIMEOUT, 60000);
context.put(JAXWSProperties.REQUEST_TIMEOUT, 70000);
context.put("com.sun.xml.ws.connect.timeout", 50000);
context.put("com.sun.xml.ws.request.timeout", 50000);
context.put("javax.xml.ws.client.connectionTimeout", 60000);
context.put("javax.xml.ws.client.receiveTimeout", 70000);
I am attching the screenshot of pcap file for your reference. Here you can see [FIN,ACK] issued by client after 6 seconds.
I am not sure if there is any other config which I am missing. Can you please help me to resolve this issue ?
Vesrions: Java : jdk1.6.0_21
Metro : Metro/2.3
HTTP: 1.1
One more thing I have noticed is, there is a "Connection: keep-alive" in request but its not there in server's response. Not sure if this could be a problem
I went into further investigation since I was having the same problem. What I found is that this is HTTP 1.1 default behavior. from wikipedia(persistent connection):
So basically what is happening is that your client is closing the connection after it's idle for the configured amount of time(connection-timeout). Jax-ws implements by default apache HttpUrlConnection which has a preconfigured 15 seconds timeout. In our client running on Weblogic 12.1.3 the following configuration worked for us: