How to call a nav webservice from android

血红的双手。 提交于 2019-12-07 18:43:57

问题


I want to call web service running in Microsoft Dynamics nav ERP i am using ksoap2 library but problem is every time i run my application it throws

java.net.ConnectException: localhost/127.0.0.1:7047 - Connection refused

Microsoft Dynamics nav is using NTLM authentication may that is the problem, please give any suggestion to solve it. Thanks in advance.

My code is

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();
        }

回答1:


Use IP Address instead of Localhost to connect to webservice from Android




回答2:


Have you added <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> to your manifest?



来源:https://stackoverflow.com/questions/12685255/how-to-call-a-nav-webservice-from-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!