Meaningless Drivel is fun!
The moose likes Web Services and the fly likes SOAPConnection call with ip address Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "SOAPConnection call with ip address" Watch "SOAPConnection call with ip address" New topic

SOAPConnection call with ip address

Kasi Viswan
Ranch Hand

Joined: Sep 27, 2008
Posts: 42

Am using SAAJ and JWSDP for my web service client.

When i make web service call using server name and port, I get a web service response.

But when i use use ip address instead of server name, i get the following error.

My endpoint goes as a String like this

The error message says wrong hostname, it is not true, when i try to send web service request to this ip address endpoint using SOAPUI, it works, but it throws error in my Java web service client. Some one please help.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
What happens if you use as the hostname, like the error message suggests?
Kasi Viswan
Ranch Hand

Joined: Sep 27, 2008
Posts: 42
IP ending in 140 is the actual value, i wanted to change it when i post it publicly. Same error as mentioned above. Please help.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
Since you use HTTPS, Java will verify the host name against the CN in the certificate.
I suspect that the CN in the certificate is the host name and in this case requests will work.
When you change it to the IP, it will not match the CN and thus fails.
There is a way to work around this during development by including the following code block in the client of the web service:

In your case, you should either insert the IP instead of localhost in the verify method, or modify the method to always return true.
Hope this solves your problems!
Kasi Viswan
Ranch Hand

Joined: Sep 27, 2008
Posts: 42

Thanks a million, This issue was splitting my head for days.

Setting verify method in the client to always return true worked. Now i am able to use ip addresses instead of server names.

You are my Hero today.

Thank you and Have a Nice Day.

I agree. Here's the link:
subject: SOAPConnection call with ip address
It's not a secret anymore!