android - Getting 'InternalServiceFault' exception when trying to invoke a svc webservice(hosted in IIS server) -
getting 'internalservicefault' exception when trying invoke svc webservice(hosted in iis server) using ksoap2 in android.
exception happening :
w/system.err﹕ soapfault - faultcode: 'a:internalservicefault' faultstring: 'operationformatter encountered invalid message body. expected find node type 'element' name 'getunits' , namespace 'http://tempuri.org/'. found node type 'element' name 'getunits' , namespace 'http://tempuri.org/irestaurant/'' faultactor: 'null' detail: org.kxml2.kdom.node@40c821a8 05-11 22:26:30.068 913-921/com.org.ansal.placemaorder w/system.err﹕ @ org.ksoap2.serialization.soapserializationenvelope.parsebody(soapserializationenvelope.java:137)
request :
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"> <soapenv:header/> <soapenv:body> <tem:itemid>1</tem:itemid> </soapenv:body> </soapenv:envelope>
invocation code:
new fetchdata(loginactivity.this).execute("http://tempuri.org/irestaurant/","getunits","http://10.0.0.2/restaurantservices/registrationservices.svc");
service call
@override protected string doinbackground(string... params) { string result=""; string _namespace = params[0]; string _method_name = params[1]; string url = params[2]; string _soap_action = _namespace + _method_name; soapobject request = new soapobject(_namespace, _method_name); request.addproperty("itemid",1); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet = true; envelope.setoutputsoapobject(request); httptransportse androidhttptransport = new httptransportse(url); try { androidhttptransport.debug = true; androidhttptransport.setxmlversiontag("<?xml version=\"1.0\" encoding= \"utf-8\"?>"); androidhttptransport.call(_soap_action, envelope); soapobject resultsrequestsoap = (soapobject) envelope.getresponse(); result = resultsrequestsoap.tostring(); system.out.println("****** result: " + resultsrequestsoap.tostring()); } catch (exception e) { system.out.println("******* there error accessing web service"); e.printstacktrace(); } return result; }
expected find node type 'element' name 'getunits' , namespace 'http://tempuri.org/'. found node type 'element' name 'getunits' , namespace 'http://tempuri.org/irestaurant/''
change namespace
from:
"tempuri.org/irestaurant/";
to:
"tempuri.org/"
Comments
Post a Comment