我在android中使用ksoap2调用.NET Web服务,我得到一个像这样的响应
anyType{NewDataSet=anyType{string=77777};
我该如何解析这个问题。请帮忙!
答案 0 :(得分:3)
这是一个多维属性数组,如:
anyType //property 0
{
NewDataSet=anyType // property 0 [0]
{
string=77777;
}
};
你可以手动解析它(这是java代码):
SoapObject yourResponseObject = (SoapObject) soapEnvelope.bodyIn;
SoapObject array = (SoapObject) yourResponseObject .getProperty(0);// this is -->anyType //property 0
SoapObject NewDataSetArray= (SoapObject)array .getProperty(0);// this is--> // property 0 [0]
//PropertyInfo propertyInfo = new PropertyInfo();
//NewDataSetArray.getPropertyInfo(0, propertyInfo);
String temp = null;
//if(propertyInfo.name.equalsIgnoreCase("NewDataset"))
//{
temp = NewDataSetArray.getProperty(0).toString();// this is 77777
//}
我没有测试它,但它应该工作,我猜你明白了。