Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore certification authentication on Axis client for WCF service

I created an axis client to WCF service (the client was generated by Eclipse, using the WSDL as an input).

The client works fine when using HTTP.

When using HTTPS I'm getting the following exception:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I understand the error, but I don't want to give it a place where the certificates are located.

I want to tell Axis to avoid this step (accept any certificate without checking it).

I know how to do it with HttpsURLConnection (create a custom validator which does nothing), but I don't know how to do it with axis... (How can I tell axis to use my custom validator, or better, how can I tell it to ignore this step at all).

Can someone help me?

Thanks,

Mattan

like image 989
Matan Avatar asked Jun 06 '12 11:06

Matan


1 Answers

I had the same problem and fixed it using:

AxisProperties.setProperty("axis.socketSecureFactory","org.apache.axis.components.net.SunFakeTrustSocketFactory");

In case this doesn't work, have a look here.

like image 193
tibtof Avatar answered Oct 04 '22 22:10

tibtof