安卓中的 SOAP 地址



我正在使用java开发一个Android移动应用程序。我正在尝试使用 Web 服务将驻留在台式计算机上的 SQL 服务器的信息检索到移动应用程序。我已经在Visual Studio中创建了Web服务。运行移动应用程序时出现以下错误。

java.net.UnknownHostException 

我知道我指定的 SOAP 地址有问题。我知道 SOAP 地址是我在 Visual Studio 中运行 Web 服务时获得的 URL。因此,当我运行 Web 服务时,URL 是:

 http://localhost:54714/WebSite1/Service.asmx

如何指定 SOAP 地址?这是一些代码:

private static final String SOAP_ACTION = "http://tempuri.org/findContact";
private static final String OPERATION_NAME = "findContact";// your webservice web metod name
private static final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";
//What do I have to change in the URL here?
private static final String SOAP_ADDRESS = "http://localhost:54714/WebSite1/Service.asmx";
http:/

/loacl host:54714 不适用于设备 应该是有效的 IP 地址

如果服务器位于运行模拟器的系统上,则可以使用

IP 地址 10.0.2.2 见链接

最新更新