I\'m trying to consume a secure (HTTPS schema) web-service with help of standard JAVA 7 JAX WS tools. This web-service requires authentication.
I have already succes
Your issue is not relating to SSL certificate. Your issue is relating to Authentication. Service instance need to be able to access WSDL content (before your stub invoke actual web method) but It failed, that is why you got that error.
You have 2 solutions:
Register default Authenticator:
static {
java.net.Authenticator.setDefault(new java.net.Authenticator() {
@Override
protected java.net.PasswordAuthentication getPasswordAuthentication() {
return new java.net.PasswordAuthentication("myuser", "mypasswd".toCharArray());
}
});
}
Download WSDL document and save it to LOCAL storage then use local WSDL file. For this solution, you have to create Service instance, NOT use generated code as you did.
Service service = Service.create(
new URL(**"file:///C:/reportingService.wsdl"**),
new QName("http://services.app/", "ReportingService")
);
// ...
binding.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "myuser");
binding.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "mypasswd");