我想调用在Microsoft Dynamics nav ERP中运行的Web服务我正在使用ksoap2库但问题是每次我运行我的应用程序它会抛出
java.net.ConnectException: localhost/127.0.0.1:7047 - Connection refused
Microsoft Dynamics导航正在使用NTLM身份验证可能是问题,请给出任何建议来解决它。 提前谢谢。
我的代码是
String namespace = "urn:microsoft-dynamics-schemas/codeunit/NavisionWS";
String url = "http://localhost:7047/DynamicsNAV/WS/Codeunit/NavisionWS";
String soap_action = "urn:microsoft-dynamics-schemas/codeunit/NavisionWS:GetLoginInfo";
String method_name = "GetLoginInfo";
try
{
SoapObject request = new SoapObject(namespace, method_name);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE transport = new HttpTransportSE(url);
transport.call(soap_action, envelope); // Receive Error here!
SoapObject result = (SoapObject) envelope.getResponse();
great = result.toString();
}
catch (Exception e)
{
e.printStackTrace();
great = e.toString();
Toast.makeText(this, great, Toast.LENGTH_LONG).show();
}
答案 0 :(得分:1)
使用IP地址而不是Localhost连接到Android的web服务
答案 1 :(得分:0)
您是否已将<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
添加到清单中?