【发布时间】:2012-06-04 03:34:33
【问题描述】:
public static UserFriendListContainer getFriendList(SoapObject wizardobject)//TESTED
{
UserFriendListContainer container= new UserFriendListContainer();
List<UserFriendListModel> list= new ArrayList();
String currobj= wizardobject.getProperty("FriendListResult").toString();
Log.v("CurrentObjet+++++++",currobj.toString());
container.setParserResult(currobj);
SoapObject result = (SoapObject)wizardobject;
for(int i=0;i<result.getPropertyCount();i++)
{
SoapObject object = (SoapObject)wizardobject.getProperty(i);//here it is break
Log.v("result:::::",result.toString());
Log.v("obj:::::",object.toString());
Log.v("friendID",object.getProperty("friendid").toString());
String friendID=object.getProperty("friendid").toString();
Log.v("friendname",object.getProperty("friendname").toString());
String friendname=object.getProperty("friendname").toString();
Log.v("lastaction",object.getProperty("lastaction").toString());
String lastaction=object.getProperty("lastaction").toString();
Log.v("friendphoto",object.getProperty("friendphoto").toString());
String friendphoto=object.getProperty("friendphoto").toString();
UserFriendListModel model=new UserFriendListModel();
model.setfriendID(friendID);
model.setfriendName(friendname);
model.setfriendPhoto(friendphoto);
model.setLastAction(lastaction);
list.add(model);
}
container.setList(list);
return container;
}
}
-----
<message name="FriendListRequest"/>
<message name="FriendListResponse">
<part name="FriendListResult" type="tns:FirendListArray"/>
</message>
我的 webservice 的 xml 部分就是那个。我试图通过解析访问我的好友列表。我无法理解 ..当我调试它时它打破了“SoapObject object = (SoapObject)wizardobject.getProperty(i)”..我想要知道如何解析我从 web 服务中获取的一个列表?谢谢您提前提供的帮助...
【问题讨论】:
标签: android web-services soap xml-parsing