For some reason, I wanted to totally ignore the certificate and trust store check with my Axis2 client stub implementations and I was looking for the solution. I came across a lot of articles which states about using HttpsURLConnection to disable SSL check, but the problem is underlying Axis2 client doesn’t use the HttpsURLConnection Solution: We can use that TrustManager to create an SSLContext which trust all the servers. SSLContext sslCtx = SSLContext . getInstance ( "TLS" ); sslCtx . init ( null , new TrustManager [] { new TrustAllTrustManager ()}, null ); APIStub client = new APIStub ( url ); client . _getServiceClient (). getOptions (). setProperty ( HTTPConstants . CUSTOM_PROTOCOL_HANDLER , new Protocol ( "https" , (ProtocolSocketFactory) new SSLProtocolSocketFactory ( sslCtx ), 443 ));
Comments
Post a Comment