开发者

Exceptions with calling web service using IP

when I call web service fro开发者_运维百科m my machine using 'localhost' or 127.0.0.1 , I got exception. But if I give the public IP, it works fine. Why it is happening?

And also, If I use my public IP, I can't access web service. But If I put the same code in another machine, and call that web service using the IP address of that machine, It works fine.

 //working fine

 url = new URL("http://192.168.50.122/NewsLetter/subscribing.php?register="+xmlString);

 //got Exception
 url = new URL("http://localhost/NewsLetter/subscribing.php?register="+xmlString);

//got Exception
 url = new URL("http://127.0.0.1/NewsLetter/subscribing.php?register="+xmlString);

 //got Exception with my public IP - 192.168.50.117
 url = new URL("http://192.168.50.117/NewsLetter/subscribing.php?register="+xmlString);

Please help me... I was trying a lot, but could not solve it.

Thank you....


As far as localhost is concerned, read the following link if you're using an emulator...

Referring to localhost from the emulated environment

http://developer.android.com/guide/appendix/faq/commontasks.html#localhostalias

I'm not sure about your other issues, however.


Sounds like a firewall issue. We'll need a lot more info to even begin to help

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜