Apache CXF客户端“连接重置”具有长请求

时间:2014-06-04 16:55:57

标签: java soap jax-ws cxf

我有一个SOAP Web服务。

从SoapUI调用它时,无论消息内容的大小如何,请求都能正常运行。

如果我从Apache CXF客户端代码发出相同的请求,它可以处理小请求,但如果我的消息内容太长,我会收到“连接重置”,但有以下例外:

Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.readFully(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1606)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1532)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1440)
... 37 more

有什么可能导致它或如何调试它的想法?

2 个答案:

答案 0 :(得分:5)

问题是由请求大小超过阈值且服务器端不支持CXF启用的chunking mechanism引起的。

这个分块可以是disabled programmatically但是CXF中有一个错误,它会使programmatic configuration is not taken into account in case of SSL connection成为错误。

解决方案是通过spring configuration file禁用分块。

答案 1 :(得分:0)

尝试:

-Dhttps.protocols=TLSv1.2

或服务器支持的任何版本。