String great = ""; String namespace = "urn:microsoft-dynamics-schemas/codeunit/CU_Vendor"; String url = "http://mch:7047/DynamicsNAV/WS/CRONUS%20International%20Ltd./Codeunit/CU_Vendor"; String soap_action = "urn:microsoft-dynamics-schemas/Codeunit/CU_Vendor:Getvendor"; String method_name = "Getvendor"; 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) { great = e.toString(); } return great; // Out there is a DialogAlert which manages output.
Comments
http://blogs.msdn.com/b/freddyk/archive ... -java.aspx
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I think "transport" is not able to handle the xml-response of SOAP-Action.
Very strange. Sadly Android doesn't support xml.bind completely...
According to my knowledge and my great web research, I have to use ksoap2-Libraries.
I have successfully used service from Java application (thanks to freddyk blog). What I am trying to do now, is to use ksoap2 library to access web service from android, but I am getting the same error message like elbarto.
Did anyone solve this problem, or does anybody have simple working example of “how to connect NAV web service from android”, that is willing to share?
Here is my code:
Where xxx.xxx.xxx.xxx is my local ip address.
In the AndroidManifest.xml I added a line Customer page is published through web service form in classic client.
Application fails on this line of code:
Any help would be appreciated.
public String url = "http://11.112.111.121:7047/DynamicsNAV/WS/andriod/Page/TestCard?wsdl";
public String soap_action = "urn:microsoft-dynamics-schemas/page/testcard:Read";
public String method_name = "Read";
protected Void doInBackground(Void... params) {
try {
SoapObject request = new SoapObject(namespace, method_name);
//request.addProperty("Username","testuser");
//request.addProperty("Password","test@123");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
NTLMTransport ntlm = new NTLMTransport();
ntlm.debug = true;
ntlm.setCredentials(url, "testuser", "test@123", "android", "");
ntlm.call(soap_action, envelope); // Receive Error here!
//SoapObject result = (SoapObject) envelope.bodyIn;
SoapPrimitive result1 = (SoapPrimitive) envelope.getResponse();
//great = response.toString();
grt11 = result1.toString();
//System.out.println(great);
System.out.println(grt11);
} catch (Exception e) {
e.printStackTrace();
//great = e.toString();
//System.out.println(great);
grt11 = e.toString();
System.out.println(grt11);
}
return null;
}
Got Error:
Attempt to invoke virtual method 'java.lang.String org.ksoap2.serialization.SoapPrimitive.toString()' on a null object reference
Any help would be greatly appreciated.
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.