我正在使用一個.net應用程序,該應用程序使用基於CXF的Web服務的數據,並且遇到了一個奇怪的斷開連接問題。雖然我已經設置所有適當的超時,我能想到的兩側,如果請求超過30秒需要更長的時間左右,那麼連接是越來越壞,我得到了以下錯誤超時問題消費來自.Net的CXF Web服務
在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
和.NET錯誤
The underlying connection was closed: The connection was closed unexpectedly. ---> System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
這似乎是WCF和許多不同問題的根源默認的錯誤。
如果我使用SoapUi連接到CXF服務,並在其中一個操作中放置斷點,我可以延遲響應的時間超過30秒的超時時間,並且一旦允許它恢復,則恢復無需一個問題和它導致我相信它正在做斷開連接的.net端。
.net客戶端配置了所有適當的超時時間,它們遠遠大於我遇到的30秒時間。
<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>
還有什麼可能會在這裏干擾和連接斷開? gzipMessageEncoding是非標準的,但在請求小於30秒的所有情況下都能正常工作。我非常樂意接受任何建議。
謝謝
Steve。
謝謝你的指針Ken,唉,這已經被嘗試過了。儘管乾杯! – sgargan 2011-02-08 18:11:18