I am trying to run the Orion SDK Java sample to connect to our Orion server and perform a simple query.
It keeps returning the 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>
http://schemas.xmlsoap.org/soap/envelope/}Server.userException
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
The "Orion SDK.pdf" mentions:
See the details of these functions below, starting with obtaining a SWIS client object, as the disableCertificateValidation() function is somewhat verbose and not presented here.
so I added the following method in my main, before calling <InformationService swis = getSwisClient("My-IP-Address", "my-login", "my-pass");>
--------------------------------------------------------------------------------------------------------------------
public static void disableCertificateValidation() {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {}
public void checkServerTrusted(X509Certificate[] certs, String authType) {}
}};
// Ignore differences between given hostname and certificate hostname
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) { return true; }
};
// Install the all-trusting trust manager
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(hv);
} catch (Exception e) {}
} // End of disableCertificateValidation()
--------------------------------------------------------------------------------------------------------------------
but it does not seem to help.
Once the locator.setBasicHttpBinding_InformationServiceEndpointAddress(address); is called it does not seem to matter and still looks for valid cert.
Ideas????
Thank you