开发者

Timeout issue consuming CXF web service from .Net

I'm working with a .net application that consumes data from a CXF based web service and i'm hittng up against a weird disconnection issue. Although I've set all the appropriate timeouts I can think of on both sides, if the request takes longer than 30 seconds or so then the connection is getting broken and I get the following errors

On cxf

    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212)
    at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000开发者_开发技巧(SelectChannelEndPoint.java:34)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.ctc.wstx.exc.WstxIOException: null
    at com.ctc.wstx.sw.BaseStreamWriter._finishDocument(BaseStreamWriter.java:1431)
    at com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:553)
    at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:282)
    ... 39 more
Caused by: org.eclipse.jetty.io.EofException
    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:148)
    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:92)
    at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:46)
    at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:55)
    at java.util.zip.GZIPOutputStream.writeHeader(GZIPOutputStream.java:123)
    at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:48)
    at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:58)
    at org.apache.cxf.transport.common.gzip.GZIPOutInterceptor$GZipThresholdOutputStream.thresholdReached(GZIPOutInterceptor.java:284)
    at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:62)
    at org.apache.cxf.io.CacheAndWriteOutputStream.write(CacheAndWriteOutputStream.java:68)
    at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:100)
    at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:225)
    at com.ctc.wstx.sw.BufferingXmlWriter.close(BufferingXmlWriter.java:198)
    at com.ctc.wstx.sw.BaseStreamWriter._finishDocument(BaseStreamWriter.java:1429)
    ... 41 more

And the .net error

The underlying connection was closed: The connection was closed unexpectedly. ---> System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.

which seems to be the default error for WCF and at the root of a number of different problems.

If I connect to the CXF service with SoapUi, and put a breakpoint in one of the operations, I can delay the response for much longer than the 30 second timeout and once it is allowed to resume, the respose goes through without a problem and Its leading me to believe that its the .net side that is doing the disconnecting.

The .net client is configured with all the appropriate timeouts and they are much greater than the 30 second one I'm running up against.

<binding name="serviceBinding" sendTimeout="20:00:00" receiveTimeout="20:00:00" openTimeout="20:00:00" closeTimeout="20:00:00">
    <gzipMessageEncoding />
    <httpTransport manualAddressing="false" decompressionEnabled="False" maxBufferPoolSize="2147483647"     
            maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Anonymous"
            bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true"      
            maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous"
            realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" />
</binding>

Is there anything else that might be intereferring here and casuing the connection to break? The gzipMessageEncoding is non standard, but works correctly in all the cases where the request is sub 30 seconds. I'm greatfully open to any suggestions.

Thanks

Steve.


The error messages don't match, but you may want to take a look here. There's a separate timeout on async operations that you can only configure via code, and that might be the one you're running into (though as I said, the error message doesn't seem to match). The actual docs are here.

You may also want to poke around with WireShark, and see if you can catch the actual underlying TCP disconnect message, and see which side actually initiates the disconnect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜