Connectors not connected are not implemented

I need to access a webservice using two-way authentication. Below is my approach.

The class MyCustomSSLSocketFactory has been created.

  • Downloaded TrustManager
  • Loaded Keystore Managers
  • Created SSL context and SSL factory socket as shown below.

I am calling this class method just before calling the webservice method.

Then I did the following: -

AxisProperties.setProperty("axis.socketSecureFactory",
                            "com.elipva.zephyr.twofa.util.MyCustomSSLSocketFactory");

Security.setProperty("ssl.SocketFactory.provider",
                    "com.elipva.zephyr.twofa.util.MyCustomSSLSocketFactory");


SSLContext context = SSLContext.getInstance(protocolVersion);
context.init(keyManagers, trustManagers, null);
SSLSocketFactory socketFactory = context.getSocketFactory();

URL url = new URL(urlString);
URLConnection connection = url.openConnection();
  if (connection instanceof HttpsURLConnection) {
    ((HttpsURLConnection) connection)
                .setSSLSocketFactory(sslSocketFactory);

            connection.connect();
        }   

      

when i access the webservice it gives me below error.

org.apache.axis2.AxisFault: Unconnected sockets not implemented
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:203)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)

      

Please let me know if I am missing something.

+3


source to share


2 answers


I think it might be this Java bug - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6771432



Note that this is presumably fixed in java 1.6.0_u14

0


source


Problem solved, just imported certificates into cacerts file.



+1


source







All Articles