https web服务调用失败

Https web service call failure

我们已经使用 JAX-WS RI 2.1.6 in JDK 6 实现了网络服务调用,现在当我们启用 https 网络服务调用停止到达服务器并且 java 报告以下错误时出现问题,

javax.xml.ws.WebServiceException: java.io.IOException: Async IO operation failed (3), reason: RC: 55 The specified network resource or device is no longer available.

现在我已经在 SoapUI 中对此进行了测试,并在那里收到了来自服务的响应。

研究了各种解决方案,告诉我们提供超时设置,但似乎没有任何效果。

 @WebEndpoint(name = "RulesSoap")
    public RulesSoap getRulesSoap() {
        ((BindingProvider)super.getPort(new QName("urn:decision:Rules", "RulesSoap"), RulesSoap.class)).getRequestContext().put("com.sun.xml.internal.ws.connect.timeout", 1000);
        ((BindingProvider)super.getPort(new QName("urn:decision:Rules", "RulesSoap"), RulesSoap.class)).getRequestContext().put("com.sun.xml.internal.ws.request.timeout", 1000);
        return super.getPort(new QName("urn:decision:Rules", "RulesSoap"), RulesSoap.class);
    }

仅供参考,JAX-WS 实现遵循几行简单的代码, 当然,我们将所有必要的数据提交到各自的存根中,但我不会在这里提交,因为我们的 http 电话正在打通,

Rules rules = new Rules(new URL(url), new QName("urn:decision:Rules", "Rules"));
RulesSoap rulesSoap = rules.getRulesSoap();
CorticonResponse response = rulesSoap.processRequest(request);

注:我们的应用服务器WebSphere Application Server和版本7.0.0.19

提前致谢。

您使用的是什么协议/密码?您已经提到在 WAS7 上使用 JDK6 连接到 Web 服务,并且 Java 6 不支持 TLS1.2(并且 TLS1.1 仅来自某些修复包)。

看这个: How to use TLS 1.2 in Java 6

经过大量努力,我们解决了这个问题。如果发生与此相关的任何事情,我将提供如何找到根本原因的步骤,

第 1 步: 首先,我们通过以下设置在 WebSphere Application Server 中启用肥皂跟踪,

Admin Console > Servers > Server Types > WebSphere Application Servers > {your server} > Troubleshooting > Change Log Detail Levels > Runtime

请在运行时间把这个,*=info: com.ibm.ws.websvcs.*=all: org.apache.axis2.jaxws.*=all

此步骤将在您的日志文件夹中创建 trace.log 文件。 现在,从您的服务器发出的任何 Web 服务请求都会将日志添加到此文件和必要的道具,如端点、请求、响应等。

第 2 步: 读取此 trace.log 文件,我们发现以下端点,

PropertyValid 1 org.apache.axis2.jaxws.client.PropertyValidator validate validate property=(javax.xml.ws.service.endpoint.address) with value=(http://uxm.solutions.lnet.com:9445/axis/dswsdl/Rules/1/0)    
HTTPConnectio 3 resetConnection : http://uxm.solutions.lnet.com:9445/axis/dswsdl/Rules/1/0 Persistent : true

现在,如果您在这里注意到我们的 soap 具有端点地址 javax.xml.ws.service.endpoint.address,其中协议仍在使用 http,这会导致 ssl 握手失败。

第 3 步: 解决方案 是覆盖 soap 存根内的端点,可以通过添加以下行来实现,

RulesSoap rulesSoap = rules.getRulesSoap();   
((BindingProvider)rulesSoap).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://uxm.solutions.lnet.com:9445/axis/dswsdl/Rules/1/0");

结论: 所以这就是我认为即使我们在创建对象时传递 https url 但仍然没有在 运行 时间接受这个 https url 对我来说这看起来像是 JAX-WS 的存根创建问题。

谢谢。