简体   繁体   中英

Soap web service is no accessible from android emulator?

嗨,我正在从我的Android应用程序中使用soap web服务,我能够从我的桌面浏览器获得响应,因为它不能在android模拟器的浏览器中运行,也可以在我在模拟器上运行的应用程序中运行。

If you are referring your localhost on your system from the Android
emulator then you have to use http://10.0.2.2:8080/ . Because Android
emulator runs inside a Virtual Machine(QEMU) therefore here 127.0.0.1 or localhost will be emulator's own loopback address.

While calling the Webservice from your Emulator Web Browser Verify that 10.0.2.2 is your machine address(run ifconfig to verify it )

let say if your webservice is

 http://localhost:39064/AndroidServiceImpl.svc/.. 

then while calling this from your emulator you have to use 10.0.2.2 instead localhost

you should call webservice like

 http://10.0.2.2:39064/AndroidServiceImpl.svc/.. 

Hope it will help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM