我在我的代码中使用asmx web服务,但没有返回正确的XML文件。这是我的代码
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();
}
回应低于......我该怎么办?
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; }; }; }
请帮我...
提前致谢
我在这个问题上苦苦挣扎,终于得到了解决方案。以下代码将为您完成这项工作。
httpTransportSE.debug=true;
httpTransportSE.call(SOAP_ACTION, envelope);
String ss=httpTransportSE.responseDump;
Log.d("--Result-- ", ss);
如果该Web服务返回xml,它将正确打印带有xml标记的Web服务输出。