To fix it, add a method to override the existing hostname verifier like this :

Before having a look at this issue resolver, go through the tutorial using SSL with jax-ws webservice

import com.roytuts.service.Hello;

import javax.xml.namespace.QName;
public class HelloSSLClient{
    static {
        //for localhost testing only
            public boolean verify(String hostname,
           sslSession) {
                if (hostname.equals("localhost")) {
                    return true;
                return false;
    public static void main(String[] args) throws Exception {
        URL url = new URL("https://localhost:8443/jax-ws-ssl/hello?wsdl");
        QName qname = new QName("",
        Service service = Service.create(url, qname);
        Hello hello = service.getPort(Hello.class);


Hello Soumitra


It’s working fine now.


I am a professional Web developer, Enterprise Application developer, Software Engineer and Blogger. Connect me on Roy Tutorials | TwitterFacebook Google PlusLinkedin | Reddit

Leave a Reply

Your email address will not be published. Required fields are marked *