.NET web service in android and not getting XML responce
I'm consuming asmx web service in my code which does not开发者_StackOverflow return proper XML file. Here is my code
private static final String SOAP_ACTION = "http://tempuri.org/ValidateLogin";
private static final String METHOD_NAME = "ValidateLogin" ;
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://ufindfish.b4live.com/FindFish.asmx";
request= new SoapObject(NAMESPACE,METHOD_NAME);
request.addProperty("sUserName",name);
request.addProperty("sPwd", password);
//envelope.bodyOut=request;
envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
envelope.encodingStyle=SoapSerializationEnvelope.XSD;
//generate httpresponce
httpTransportSE=new HttpTransportSE(URL);
try {
httpTransportSE.call(SOAP_ACTION,envelope);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (XmlPullParserException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
SoapObject result = null;
try {
result=(SoapObject)envelope.getResponse();
//Log.i("RESPONCE",""+result.toString());
} catch (SoapFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
response is below...what should i do?
anyType{NearLake=anyType{tblNearLake=anyType{LAKE=2022C01 BENSFORT BRIDGE to PETERBOROUGH; LAT=11.622; LON=20.616; }; tblNearLake=anyType{LAKE=2022C01 BENSFORT BRIDGE to PETERBOROUGH; LAT=11.186; LON=19.443; }; }; }
please help me...
Thanks in advance
I struggled a lot with this issue and finally got solution. The following code will do the job for you.
httpTransportSE.debug=true;
httpTransportSE.call(SOAP_ACTION, envelope);
String ss=httpTransportSE.responseDump;
Log.d("--Result-- ", ss);
It will print the webservice output with xml tags properly if that web service returns a xml.
精彩评论