aspose file tools*
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
JavaRanch » Java Forums » Java » Web Services
Bookmark "SOAPConnection call with ip address" Watch "SOAPConnection call with ip address" New topic
Author

SOAPConnection call with ip address

Kasi Viswan
Ranch Hand

Joined: Sep 27, 2008
Posts: 42
Hello,

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 https://65.167.11.154/Domain/Services/Management

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.

Thanks
Kasi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42611
    
  65
What happens if you use 65.167.11.140 as the hostname, like the error message suggests?


Ping & DNS - my free Android networking tools app
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
    
    1
Hi!
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
Ivan,

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.

Regards
Kasi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SOAPConnection call with ip address