【发布时间】:2017-12-04 15:15:37
【问题描述】:
我正在运行 tomcat 服务器并尝试使用 .NET SOAP WS。 用 apache.cxf 来做。
.NET WS 有集群,当在其中一台机器上执行重启时,我得到了
javax.xml.ws.WebServiceException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:148)
...
Caused by: java.net.SocketException: Connection reset
为避免这种情况,我只想为这个 WS 消耗使用 connection=close 标头。
所以,在创建 SOAP 消息时,我发送
HTTPConduit conduit = (HTTPConduit) iMyFlowWSClient.getConduit();
conduit.getClient().setConnection(ConnectionType.CLOSE);
我在 wireshark 上看到标头得到了正确的值:
Connection: close\r\n
但是,当 java.xml.ws.Service 的构造器初始化 wsdl url 时,第一次调用 WS 时(看起来像导入 xsd):
protected Service(java.net.URL wsdlDocumentLocation, QName serviceName) {
delegate = Provider.provider().createServiceDelegate(wsdlDocumentLocation,
serviceName,
this.getClass());
}
我在 Wireshark 上看到了下一个标题:
Hypertext Transfer Protocol
GET /MyFlow.svc?wsdl HTTP/1.1\r\n
Content-Type: text/xml\r\n
Accept: */*\r\n
User-Agent: Apache CXF 3.0.0\r\n
Cache-Control: no-cache\r\n
Pragma: no-cache\r\n
Host: 123.123.12.34\r\n
Connection: keep-alive\r\n
\r\n
[Full request URI: http://123.123.12.34/MyFlow.svc?wsdl]
我相信是什么让这种与 WS 的联系保持活力。
是否有任何解决方案可以配置 apache.cxf 标头以在 HTTP 级别执行的所有请求上发送 connection=close?
【问题讨论】:
标签: java apache web-services soap cxf