You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Paul Thomas <pa...@viajar.com> on 2005/07/18 15:32:55 UTC

Resolve problem with digital handshake

Hi there,
I am trying to connect to an endpoint which is https and I get the
following error:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: javax.net.ssl.SSLHandshakeException: 
java.security.cert.CertificateException: Could not find trusted certificate
 faultActor:
 faultNode:
 faultDetail:

To try to resolve this I wrote a bogus TrustManager:

SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, AxisTrustManager.getAxisTrustManager(), new 
java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());

The thing is I don't really know where I should be putting this snippet 
of code. At the moment, it is
in the soap stub where I invoke the webservice, but it doesn't work.

If anybody has already sorted this out, would they mind telling me where 
I should use this code?

Thanks in advance,

Paul

Re: Resolve problem with digital handshake

Posted by Paul Thomas <pa...@viajar.com>.
Found the solution:
You must put the following line before you invoke the call:

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

Paul

> Hi there,
> I am trying to connect to an endpoint which is https and I get the
> following error:
>
> AxisFault
> faultCode: 
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> faultString: javax.net.ssl.SSLHandshakeException: 
> java.security.cert.CertificateException: Could not find trusted 
> certificate
> faultActor:
> faultNode:
> faultDetail:
>
> To try to resolve this I wrote a bogus TrustManager:
>
> SSLContext sc = SSLContext.getInstance("SSL");
> sc.init(null, AxisTrustManager.getAxisTrustManager(), new 
> java.security.SecureRandom());
> HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
>
> The thing is I don't really know where I should be putting this 
> snippet of code. At the moment, it is
> in the soap stub where I invoke the webservice, but it doesn't work.
>
> If anybody has already sorted this out, would they mind telling me 
> where I should use this code?
>
> Thanks in advance,
>
> Paul
>
>