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.
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; } }
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());
setup custom context, calling
httpsurlconnection#setdefaultsslsocketfactory
based on fact web service calls based on underlying instance ofhttpsurlconnection
. call setup context, way ofsslcontext#getcontext
, all https callshttpsurlconnection.setdefaultsslsocketfactory(sctxt.getsocketfactory());
Comments
Post a Comment