Android模拟器无法访问肥皂网络服务?

时间:2022-11-18 09:52:02

Hi I am consuming a soap web service from my android application, I was able to get the response from my desktop browser where as it is not working in android emulator's browser and also in my application which runs on the emulator.

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

1 个解决方案

#1


2  

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.

如果您从Android模拟器中引用系统上的本地主机,则必须使用http://10.0.2.2:8080/。因为Android模拟器在虚拟机(QEMU)内部运行,因此127.0.0.1或localhost将是模拟器自己的环回地址。

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

从仿真器Web浏览器调用Web服务时验证10.0.2.2是否为您的机器地址(运行ifconfig进行验证)

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

然后在从模拟器调用它时,您必须使用10.0.2.2而不是localhost

you should call webservice like

你应该像web服务一样打电话

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

Hope it will help.

希望它会有所帮助。

#1


2  

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.

如果您从Android模拟器中引用系统上的本地主机,则必须使用http://10.0.2.2:8080/。因为Android模拟器在虚拟机(QEMU)内部运行,因此127.0.0.1或localhost将是模拟器自己的环回地址。

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

从仿真器Web浏览器调用Web服务时验证10.0.2.2是否为您的机器地址(运行ifconfig进行验证)

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

然后在从模拟器调用它时,您必须使用10.0.2.2而不是localhost

you should call webservice like

你应该像web服务一样打电话

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

Hope it will help.

希望它会有所帮助。