0

解析肥皂响应时出现以下错误。

java.lang.ArrayIndexOutOfBoundsException:长度=0;索引=3

SOAP 响应:

anyType{ItemId=anyType{}; ItemCode=anyType{}; ItemDescription=10000; UOM=EA; UOMDescription=EA; ItemQty=10000; DelivertoLocId=2005; DelivertoLoc=H1- Retail; }

我使用的代码:

SoapObject result = (SoapObject) envelope.bodyIn;
for (int i = 0; i < result.getPropertyCount(); i++) 
{ 
     SoapObject obj = (SoapObject) result.getProperty(i);
     Log.d("obj : ", ""+obj);
     Log.d("obj", ""+ obj.getAttribute(3).toString());  // value of column 3
     Log.d("obj1", ""+obj.getProperty(4).toString());  // value of column 4
}

以上是解析的正确方法吗?

4

1 回答 1

0
SoapObject result = (SoapObject) envelope.bodyIn;
for (int i = 0; i < result.getPropertyCount(); i++) 
{ 
     SoapObject obj = (SoapObject) result.getProperty(i);
     Log.d("obj : ", ""+obj);
     //Log.d("obj", ""+ obj.getAttribute(3).toString());  // value of column 3
     Log.d("obj1", ""+obj.getProperty(4).toString());  // value of column 4
}
于 2013-07-01T08:45:17.743 回答