0

(I am reposting this question from stackoverflow. If there is some way that I can join the questions or just move the question please let me know. Thanks.)

I am attempting to convert a http webservice to https. I added the tags to the webservice.

@SecurityDomain(value = "jbossws-ssl")

and

@WebContext(contextRoot="/common/ws",  // already here
 urlPattern="/A2",   // already here
    authMethod = "CLIENT-CERT",  // added
    transportGuarantee = "CONFIDENTIAL") // added

But when my client trys to connect to https://host:80/path/to/ws I get an exception:

Caused by: java.io.IOException: HTTPS hostname wrong: should be <host>.

( entire thing shown below). I suspect that this has to do with the certificate that is being used. I think that I need to use the java keytool to resolve this. If someone could verify for me it would be greatly appreciated.

javax.xml.soap.SOAPException: java.io.IOException: Could not transmit message
        at org.jboss.ws.core.soap.SOAPConnectionImpl.callInternal(SOAPConnectionImpl.java:115)
        at org.jboss.ws.core.soap.SOAPConnectionImpl.call(SOAPConnectionImpl.java:66)
        at com.alcatel.tpapps.common.utils.SOAPClient.execute(SOAPClient.java:146)
        at com.alcatel.tpapps.common.utils.SOAPClient.main(SOAPClient.java:233)
Caused by: java.io.IOException: Could not transmit message
        at org.jboss.ws.core.client.RemotingConnectionImpl.invoke(RemotingConnectionImpl.java:192)
        at org.jboss.ws.core.client.SOAPRemotingConnection.invoke(SOAPRemotingConnection.java:77)
        at org.jboss.ws.core.soap.SOAPConnectionImpl.callInternal(SOAPConnectionImpl.java:106)
        ... 3 more
Caused by: org.jboss.remoting.CannotConnectException: Can not connect http client invoker. HTTPS hostname wrong:  should be <host>.
        at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:368)
        at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:148)
        at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:141)
        at org.jboss.remoting.Client.invoke(Client.java:1858)
        at org.jboss.remoting.Client.invoke(Client.java:718)
        at org.jboss.ws.core.client.RemotingConnectionImpl.invoke(RemotingConnectionImpl.java:171)
        ... 5 more
Caused by: java.io.IOException: HTTPS hostname wrong:  should be <host>
        at sun.net.www.protocol.https.HttpsClient.checkURLSpoofing(HttpsClient.java:490)
        at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:415)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:170)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:857)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
        at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:288)
        ... 10 more

Update 1

I tried the following but it had no effect on the exception:

host[user:/path][525]% keytool -genkey -keystore server.keystore -alias host
...
...

Update 2

Actually not sure what I did in Update 1 was right because I did not have to specify a host name there...

1 Answer 1

1

the error message is complaining about your port. http normally runs on port 80 and https on port 443. you are trying to use https on port 80. change your call from

https://sco-up:80/path/to/ws

to

https://sco-up/path/to/ws

this will automatically use port 443 for the https connection.

3
  • @Christian, thanks for the comment. I think right now I am using port 8443. But I am getting the same error. I think that 8443 is also acceptable for https? Feb 4, 2010 at 14:47
  • sure, it is the default tomcat ssl port. did you change your url to https://sco-up:8443/path/to/ws?
    – Christian
    Feb 4, 2010 at 14:54
  • what you did in update1 was generating a key with alias sco-up. what you should have done is generate a certificate with alias sco-up. this alias has to match the hostname. here are two links: how to create a self-signed certificate: akadia.com/services/ssh_test_certificate.html and how to import it into a java keystore: chrissearle.org/blog/technical/…
    – Christian
    Feb 4, 2010 at 15:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .