java - Equivalent of org.apache.axis.components.net.SunFakeTrustSocketFactory for wsimport -


when generate webservice client stubs using apache axis, disable server certificate trust check in code using client stubs calling following method

axisproperties.setproperty("axis.socketsecurefactory",      "org.apache.axis.components.net.sunfaketrustsocketfactory"); 

how disable trust check client stubs generated running wsimport?

i use when running test code.

all that's happening in class provision of bogus trust store manager, trusts anything. knowing that, can use this article , put together.

  1. first easy trust manager

    public class easytrustmanager implements x509trustmanager {   public void checkclienttrusted(x509certificate[] chain, string authtype) {         //do nothing   }    public void checkservertrusted(x509certificate[] chain, string authtype) {        //do nothing   }    public java.security.cert.x509certificate[] getacceptedissuers() {        return null;   } } 
  2. then feed trust manager instance of sslcontext, axis doing:

    sslcontext sctxt = sslcontext.getinstance("ssl");  sctxt.init(null, new trustmanager[]{new easytrustmanager()}, new java.security.securerandom());  
  3. setup custom context, calling httpsurlconnection#setdefaultsslsocketfactory based on fact web service calls based on underlying instance of httpsurlconnection. call setup context, way of sslcontext#getcontext, all https calls

    httpsurlconnection.setdefaultsslsocketfactory(sctxt.getsocketfactory());   

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -