Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem invoking webservice when 'localhost' in endpoint replaced by machinenm/ipaddr  RSS feed

 
moto raja
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,


I have developed a webservice and hosted it on WebSphere AppServerr6.0, I have used an IDE (Rational App Developer) to create the webservice and wsdl's. The endpoint thats created for the webservice looks something like :

http://localhost:4400/ProjectSource/services/projectsourceservicecall

This webservice is running fine when I put in the above url in the browser and can see its working. The webservice is running on my machine itself.

The problem I am facing is that if I replace the 'localhost' in the endpoint with the name of my machine name or ipaddress, I get to see a 'Page Cannot be Displayed' error.
I really dont see any difference in both endpoints.

I am sure that the network is able to recognize the machine name/ipaddress because I can test other applications(NOT WEBSERVICES) by using the machine name/ipaddress instead of the localhost.

For ex, when I have my websphere portal server runnign, I can type in
http://mymachineIpAddress:9081/wps/portal (this is the homepage for my portal launched on my macine) and its working.


Please suggest me where I am going wrong.

Your earliest solutions are appreciated.

Thanks,
Ravi.
 
Karthik Rajendiran
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, one question,
can you tell me is there any proxy configured in your machine.

Try adding your computer name or ip in the bypass proxy list and give a try. This might be a wild guess try. Lets try.

Reply back
 
moto raja
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the reply.No, there is no proxy configured at my machine.

Thats the reason Ive mentioned that other applications like portals can be accessed using machine name/ip address in the url.

Please let me know if there are anywhere else I'm doing wrong.


Thanks
Ravi.
 
michael warren
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could it be a firewall on your machine blocking port 4400 ?
Don't fully understand the significance of using IP address or localhost - but guess that localhost is known to be local but actual IP address is affected by firewall, would that make sense ?

Not really related but wonder if using loopback address 127.0.0.1 would be equivalent to localhost.
 
Wojtek Thomas
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have got the same problem. I configured my Sun Application Server 9 to listen on localhost port only (127.0.0.1), because I connect my laptop to many differents networks (university, home) and I don't want to publish application server to the world.

Now I am dealing with Sun's tutorial "firstwebcup". Everything was ok when application server had been listening on all ip ports. My troubles began after I had reconfigured it to listen 127.0.0.1 port only .

Now when I connect to deployed web service through the browser I get XML, that shows that web service schema is available under hard coded address "http://192.168.130.4:8080/..." - where 192.168.130.4 is IP address in my home network.

When I try to get connection from ejb to web service, logs show that it is unable to connect to "http://192.168.230.155:8080/...", where 192.168.230.155 is IP address from DHCP at the university (I have deployed web application when I was connected to the network of my university).

In this project I have used "localhost" everywhere, for each service. It seems that NetBeans or Java Application Server resolves localhost to IP address of my network card.

Now, as you know why replacing endpoint with ipaddress is a problem, could you help us?
 
michael warren
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know why its a problem - I've tried to replicate it by blocking a port
( following instructions here http://support.microsoft.com/kb/813878 , for anyone who's interested in doing it on Windows ), but I was still able to use the machine's IP address (I double checked that the port was actually blocked by trying to connect from another PC). Be interested to hear if yo get to the bottom of this.

localhost and 127.0.0.1 should be equivalent, assuming hosts file (normally in C:\WINDOWS\system32\drivers\etc on Windows) is set up correctly.
 
Wojtek Thomas
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found simple workaround: before deploying web service disconnect your computer from network. Then wsdl file will have requested address http://localhost:8080/....
 
Wojtek Thomas
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Michael,

Thank your for your responses, but I suppouse that you don't understand our problem:

When webservice is deployed, its wsdl file consists information, that web service schema is available under ipaddress of my computer, and not under localhost address. When I switch my computer from home netowork to the university network and it gets new ipaddress, then all web services become unavailable, because they listen on ipaddress of my home network and not university network.

Regards,
Wojtek
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!