Search code examples
javaweb-servicessoapwebspherejax-ws

Https web service call failure


We have implemented webservice call using JAX-WS RI 2.1.6 in JDK 6 now problem comes when we enable https webservice call stops reaching server and java reports following error,

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.

Now I have tested this within SoapUI and response from the service is received there.

Looked into various solution where it tells us to provide timeout settings but nothing seems work.

 @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);
    }

And just for information JAX-WS implementation is following few simple lines, of course we submit all necessary data into respective stubs and all but I am not submitting here because our http calls are getting through,

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

Note : Our application server WebSphere Application Server and Version 7.0.0.19

Thanks in Advance.


Solution

  • After lots of efforts we resolved this. I will provide steps if anything related to this happens how to find root cause,

    Step 1 : First of all we enabled soap tracing in WebSphere Application Server by following setting,

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

    In run time please put this , *=info: com.ibm.ws.websvcs.*=all: org.apache.axis2.jaxws.*=all

    This step will create trace.log file in your logs folder. Now any web service request which goes out of your server will add logs to this file and necessary props like endpoint, request, response etc.

    Step 2 : Reading this trace.log file we found following endpoint,

    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
    

    Now if you notice here that our soap has endpoint address javax.xml.ws.service.endpoint.address where protocol is still using http which causes to fail ssl handshake.

    Step 3 : Solution for this is to override endpoint inside your soap stubs which can be implemented by adding following line,

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

    Conclusion : So here is what i think even we pass https url while we are creating objects but still does not take this https url on runtime, to me this looks like stubs creation issue with JAX-WS.

    Thanks.