Hi,
I'm trying to access my webservices via SSL using https.
Below is my program. When I type my webservice URL with https in
the browser I get the correct page, but when I'm trying to execute the
below program, I'm getting the below exception. (I'm using Axis 1.3)
Am I missing anything else?
Exception
---------
Exception: ; nested exception is:
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
My Program
-----------
import java.net.*;
import myservice.ws.client.*;
public class TestSSLWebServices {
public static void main(String[] args) {
System.setProperty("java.security.policy","C:\\Program
Files\\Java\\jre1.5.0_06\\lib\\security\\java.security");
System.setProperty("javax.net.ssl.trustStore", "C:\\Program
Files\\Java\\jre1.5.0_06\\lib\\security\\cacerts");
System.setProperty("javax.net.ssl.trustStorePassword",
"changeit");
// verify web service connection configuration
String sUrl = null;
MyServiceWS service = null;
try {
sUrl = "https://xxxxx.xxx.xxx/webservices/MyServiceWS";
URL url = new URL(sUrl);
MyServiceWSService svcs = new MyServiceWSServiceLocator();
service = svcs.getMyServiceWS(url);
((MyServiceWSSoapBindingStub)
service).setMaintainSession(true);
// configure connection timeout
((MyServiceWSSoapBindingStub)
service).setTimeout(60*60*1000);
boolean login = service.login("raghu","xxxx");
System.out.println ("Login Result = " + login);
String[] folders = service.listFolders();
for (String folder : folders) {
System.out.println ("Folder Name = " + folder);
}
boolean logout = service.logout();
System.out.println ("Logout Result = " + logout);
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
System.exit(1);
}
}
}