解决方案:5分
public static CenterInfo[] getWorkOn(SoapObject obj){
CenterInfo[] info = null;
try{
if(obj.getPropertyCount() > 1){//有中心信息
int len = obj.getPropertyCount() – 1;
info = new CenterInfo[len];
for(int i = 0;i < len;i++){
SoapObject child = (SoapObject)obj.getProperty(i + 1);
String idStr = child.getPropertyAsString(0);
String content = child.getPropertyAsString(1);
String sender = child.getPropertyAsString(2);
String typeStr = child.getPropertyAsString(3);
String uId = child.getPropertyAsString(4);
String time = child.getPropertyAsString(5);//时间
long id = Long.parseLong(idStr);
int type = Integer.parseInt(typeStr);
info[i] = new CenterInfo(id,content,sender,type,uId,time);
}
}
}catch(Exception e){
e.printStackTrace();
}
return info;
}
CenterInfo[] info = null;
try{
if(obj.getPropertyCount() > 1){//有中心信息
int len = obj.getPropertyCount() – 1;
info = new CenterInfo[len];
for(int i = 0;i < len;i++){
SoapObject child = (SoapObject)obj.getProperty(i + 1);
String idStr = child.getPropertyAsString(0);
String content = child.getPropertyAsString(1);
String sender = child.getPropertyAsString(2);
String typeStr = child.getPropertyAsString(3);
String uId = child.getPropertyAsString(4);
String time = child.getPropertyAsString(5);//时间
long id = Long.parseLong(idStr);
int type = Integer.parseInt(typeStr);
info[i] = new CenterInfo(id,content,sender,type,uId,time);
}
}
}catch(Exception e){
e.printStackTrace();
}
return info;
}
解决方案:20分
解析的是你获取的对象啊 你获取的什么就解析什啊? 你获取的SoapObject 难道要转成别的类型再用json解析?
解决方案:5分
这要看写http://192.168.1.195:88/service1.asmx这个webservice的怎么定义返回数据的