Skip to main content

How to setHostNameVerifier on a web service running from glassfish

No replies
dboileau
Offline
Joined: 2010-01-06

Hello.

how to you set the HostNameVerifier with a Web Service Client running within a EJB on a glassfish Server.

I have tried the following but it does not appear to work. I need to to this because the client certificate used is a wildcard certificate and GF does not appear to like it.

private String getServerStatus() {
GatewaySoap port = service.getGatewaySoap();
MyHostnameVerifier hostNameVerifier = new MyHostnameVerifier();
((BindingProvider) port).getRequestContext().
put(JAXWSProperties.HOSTNAME_VERIFIER, hostNameVerifier);
return port.getServerStatus();
}

class MyHostnameVerifier implements HostnameVerifier {

public boolean verify(String string, SSLSession ssls) {
return true;
}