I am having a lot of trouble finding good information on how to call a standard SOAP web service in Android. any help
Asked
Active
Viewed 444 times
0
-
What trouble you are getting ? – user3317558 Feb 17 '14 at 10:57
-
am not getting any trouble, i don't have any idea how to use SOAP? – venu Feb 17 '14 at 10:58
-
have you [googled it](https://www.google.co.in/?gfe_rd=cr&ei=kusBU86GBOrV8gfQs4GQDQ#q=Android%2BSoap+Example) ? – user3317558 Feb 17 '14 at 11:00
-
yes i but am not getting better inofrmation about it – venu Feb 17 '14 at 11:01
2 Answers
0
Use this below code to call SOAP web service from Android using NTLM AUTHENTICATION.
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.implicitTypes = true;
soapEnvelope.dotNet = true;
SoapObject soapReq = new SoapObject("urn:microsoft-dynamics-schemas/page/customercard","Read");
soapEnvelope.setOutputSoapObject(soapReq);
propinfo = new PropertyInfo();
propinfo.setName("No");
propinfo.setValue(no);
propinfo.setType(no.getClass());
propinfo.setNamespace("urn:microsoft-dynamics-schemas/page/customercard");
soapReq.addProperty(propinfo);
NtlmTransport ntlm = new NtlmTransport(url, userid, password, domainname,systemname);
try{
if (headers!=null){
ntlm.call("urn:microsoft-dynamics-schemas/page/customercard/Read", soapEnvelope,headers);
}else{
ntlm.call("urn:microsoft-dynamics-schemas/page/customercard/Read", soapEnvelope);
}
Object retObj = soapEnvelope.bodyIn;
if (retObj instanceof SoapFault){
SoapFault fault = (SoapFault)retObj;
Exception ex = new Exception(fault.faultstring);
if (eventHandler != null)
eventHandler.Wsdl2CodeFinishedWithException(ex);
}else{
SoapObject result=(SoapObject)retObj;
if (result.getPropertyCount() > 0){
System.out.println("RESULT 2"+result);
Object obj = result.getProperty(0);
SoapObject j = (SoapObject)obj;
}

i.n.e.f
- 1,773
- 13
- 22
0
First of all you should call a web service through a AsyncTask. You must have a bean class and add internet permission in your manifest file. Check this Example for your reference

Yashwanth
- 880
- 3
- 13
- 21