Skip to main content

JAX WS 2.0 client - unexpected end of file

3 replies [Last post]
waczack
Offline
Joined: 2007-04-20

Hi!

I have a web service deployed in JBoss-4.0.5.GA. I connect to it using JAX-WS 2.0. Normally it works correct, but when the server method runs longer than 30 seconds my client got an error (even if I only call a Thread.sleep(35000) in the server method):
javax.xml.ws.WebServiceException: java.net.SocketException: Unexpected end of file from server

The server does not throw an exception immediately, but when it finishes the method (for example 40 seconds after calling it) it throws an exception, that the pipe is broken.

The tricky is, that this problem only occurs at the business server, thats why I do not attach stack traces (I can not access them now). On my test server all methods work correct.

This looks like a timeout, but I did not set the "com.sun.xml.ws.request.timeout" property of the request context (even if this parameter is set, and the request keeps longer, the thrown exception is not the same), and all the settings are the same on my test server.

regards,
waczack

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
waczack
Offline
Joined: 2007-04-20

I could try it out on the business environment, so I have to client logs now:

javax.xml.ws.WebServiceException: javax.xml.ws.WebServiceException: java.net.SocketException: Unexpected end of file from server
at com.sun.xml.ws.util.SOAPConnectionUtil.getSOAPMessage(SOAPConnectionUtil.java:81)
at com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder.toSOAPMessage(SOAPXMLDecoder.java:100)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:438)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:258)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:137)
at com.sun.xml.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:84)
at com.sun.xml.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocationHandler.java:172)
at com.sun.xml.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.java:106)
at $Proxy19.getNTCData(Unknown Source)
at com.astron.kapart.communication.WsDataLoader.getNtcData(WsDataLoader.java:1475)
at com.astron.kapart.gui.operator.ntc.NtcIFrame$17.task(NtcIFrame.java:715)
at com.astron.kapart.gui.common.GUITask.run(GUITask.java:85)
Caused by: javax.xml.ws.WebServiceException: java.net.SocketException: Unexpected end of file from server
at com.sun.xml.ws.transport.http.client.HttpClientTransport.checkResponseCode(HttpClientTransport.java:313)
at com.sun.xml.ws.transport.http.client.HttpClientTransport.getHeaders(HttpClientTransport.java:158)
at com.sun.xml.ws.util.SOAPConnectionUtil.getSOAPMessage(SOAPConnectionUtil.java:57)
... 11 more
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:741)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:604)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:738)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:604)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:957)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:318)
at com.sun.xml.ws.transport.http.client.HttpClientTransport.checkResponseCode(HttpClientTransport.java:271)
... 13 more
javax.xml.ws.WebServiceException: javax.xml.ws.WebServiceException: java.net.SocketException: Unexpected end of file from server
at com.sun.xml.ws.util.SOAPConnectionUtil.getSOAPMessage(SOAPConnectionUtil.java:81)
at com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder.toSOAPMessage(SOAPXMLDecoder.java:100)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:438)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:258)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:137)
at com.sun.xml.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:84)
at com.sun.xml.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocationHandler.java:172)
at com.sun.xml.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.java:106)
at $Proxy19.getNTCData(Unknown Source)
at com.astron.kapart.communication.WsDataLoader.getNtcData(WsDataLoader.java:1475)
at com.astron.kapart.gui.operator.ntc.NtcIFrame$17.task(NtcIFrame.java:715)
at com.astron.kapart.gui.common.GUITask.run(GUITask.java:85)
Caused by: javax.xml.ws.WebServiceException: java.net.SocketException: Unexpected end of file from server
at com.sun.xml.ws.transport.http.client.HttpClientTransport.checkResponseCode(HttpClientTransport.java:313)
at com.sun.xml.ws.transport.http.client.HttpClientTransport.getHeaders(HttpClientTransport.java:158)
at com.sun.xml.ws.util.SOAPConnectionUtil.getSOAPMessage(SOAPConnectionUtil.java:57)
... 11 more
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:741)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:604)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:738)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:604)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:957)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:318)
at com.sun.xml.ws.transport.http.client.HttpClientTransport.checkResponseCode(HttpClientTransport.java:271)
... 13 more

joshuad
Offline
Joined: 2008-01-22

This looks like your underlying OS is set with a socket timeout of 30 seconds - if you don't explicitly specify a timeout then the system timeout takes precedent. In order to get around this, specify a longer timeout on your Web Service call.

waczack
Offline
Joined: 2007-04-20

If I specify a longer socket timeout on the client side using:

((BindingProvider) port).getRequestContext().put( "com.sun.xml.ws.request.timeout", 40 );

I recieve the same error at 30 seconds. Anyway, if I set it to a lower value (for example 20) I get another exception after 20 seconds:

javax.xml.ws.WebServiceException: javax.xml.ws.WebServiceException: java.net.SocketTimeoutException: Read timed out
at com.sun.xml.ws.util.SOAPConnectionUtil.getSOAPMessage(SOAPConnectionUtil.java:81)
at com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder.toSOAPMessage(SOAPXMLDecoder.java:100)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:438)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:258)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:137)
at com.sun.xml.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:84)
at com.sun.xml.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocationHandler.java:172)
at com.sun.xml.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.java:106)
at $Proxy19.login(Unknown Source)

This means that timeout should be changed on the server side? (I use jboss 4.0.5. GA on the server side.)