views:

548

answers:

2

I have a Axis 1.4 (with Spring) web service client consuming a PHP web service (running on Apache). This works perfectly in the development environment, but in the production environment the code execution hangs somewhere in the Axis library directly after the client has received the SOAP response. I have identified with Wireshark that the only difference from the client perspective is that in development environment the HTTP header of the SOAP Response contains the entry


Connection: close

which is missing in production environment. My assumption is that this is the reason the code execution hangs, because Axis is expecting the connection close header field.

Is there something I can do to remedy this by configuring the client? If not, any hints for configuring Apache + PHP to close the connection correctly are appreciated.

+2  A: 

You might try sending Http Header "Connection: close" with your request.

HeavyWave
+2  A: 

Try setting the -Dhttp.keepAlive=false system property in your application, if can afford disabling keep alives in other parts of the application. This will prevent certain hangs with the java-internal HttpClient class trying to eagerly fill a BufferedInputStream from the open connection.

For details see also http://bugs.sun.com/bugdatabase/view%5Fbug.do?bug%5Fid=4479751 .

If this has a chance of helping you have a look at the stack trace of your hanging client, it should look like this:

java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read1(BufferedInputStream.java:258) at java.io.BufferedInputStream.read(BufferedInputStream.java:317) - locked <0xab82fa30> (a java.io.BufferedInputStream) at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1072) - locked <0xab82c838> (a sun.net.www.protocol.http.HttpURLConnection)

The http.keepAlive setting essentially ensures that the HttpClient will always send a 'connection: close' as suggested by HeavyWave.

ankon