简体   繁体   English

从Android设备调用REST Web服务

[英]REST web service calls from android device

I made an android application which connects to a local web service on my desktop computer, in a network with a router. 我制作了一个Android应用程序,它连接到台式计算机上的本地Web服务,在带有路由器的网络中。

In AVD, I managed to make calls to the web service, but I have problems when I deploy the application on my android device (connection timeout). 在AVD中,我设法调用Web服务,但是当我在Android设备上部署应用程序时出现问题(连接超时)。 The phone was connected to the same network, but the call does not work. 手机已连接到同一网络,但通话无效。

Is there a simple way to make calls to the web service from the device? 有没有一种简单的方法从设备调用Web服务? What are the ways to do this? 有什么方法可以做到这一点?

make sure that the url you are trying to reach is reachable. 确保您尝试访问的网址可以访问。 For example your computer may be behind a firewall which is not allowed to be accessed from outside the network. 例如,您的计算机可能位于防火墙后面,不允许从网络外部访问。 You can connect your phone to wireless access point on the same network as your computer. 您可以将手机连接到与计算机位于同一网络的无线接入点。

or you can place the web service on a server that is web accessible. 或者您可以将Web服务放在可通过Web访问的服务器上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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