我正在使用 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";