我在我的代码中使用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();
}回答是below...what,我应该怎么做?
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; }; }; }请帮帮我。
提前感谢
发布于 2012-09-19 16:43:51
我在这个问题上挣扎了很多,终于找到了解决方案。下面的代码将为您完成这项工作。
httpTransportSE.debug=true;
httpTransportSE.call(SOAP_ACTION, envelope);
String ss=httpTransportSE.responseDump;
Log.d("--Result-- ", ss);如果web服务返回xml,它将正确地打印带有xml标记的web服务输出。
https://stackoverflow.com/questions/5648659
复制相似问题