奇怪的是,object.toString()在android虚拟机上输出的结果和网页打开webservice的结果也不同。求教~~~?
解决方案 »
- 请教怎样在ubuntu11.10下为Android 源码指定media下的其它挂载硬盘为源码的下载文件夹呢?
- 若水老师的视频代码出问题啦!!!
- 触摸屏问题 [按键有KEY_DOWN 没有KEY_UP]
- 求助,gridview加載的問題
- 关于ANDROID编译的疑问呀!
- “The operation cannot be completed. See the details ”
- 使用AsyncHttpClient遇到 http 500错误不停的 GC
- 哪位大神知道PhoneGap使用BarcodeScanner插件的具体步骤,最好是有ZXing库的那种
- AlarmManager 如何在其他activity中关闭,貌似只能拿到当前设置的PendingIntent才可以关闭?
- 请教关于android上的广告嵌入问题?
- 项目中频繁通话报出空异常!求思路解决!
- 将view添加到WindowManager时如何获得View所需大小的问题?
System.out.println(result.toString());
如果说你图片上得结果是在这里打印出来的,说明你的webservice有问题。
是有结果的,内容就是第一个xml code。我也怀疑过,试图将object保存成文件通过文本编辑器查看内容,因为虚拟机问题未果。
返回的xml 是对的么?我已经贴在1楼了。感谢2位的回答。
List<Course> courses = new ArrayList<Course>();
int iCount = result.getPropertyCount();
for(int i = 0; i < iCount; i++){
SoapObject child = (SoapObject)result.getProperty(i);
Course course = new Course();
course.courseId = child.getPropertyAsString("kcdm").trim();
course.teacher = child.getPropertyAsString("xm").trim();
course.name = child.getPropertyAsString("kcmc").trim();
course.schoolYear = child.getPropertyAsString("xn").trim();
course.schoolTerm = child.getPropertyAsString("xq").trim();
course.department = child.getPropertyAsString("yxmc").trim();
course.studentID = studentID;
courses.add(course);
}
Log.d(TAG, "获取课程数 :" + courses.size());
return courses;
}这事我用来解析webservice返回结果的方法,webservice返回到结果是下面的形式,<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<M_GetKCInfoByStudentIDResponse xmlns="http://JCWebService.lib.sjtu.edu.cn/">
<M_GetKCInfoByStudentIDResult>
<KCInfo>
<kcdm>string</kcdm>
<kcmc>string</kcmc>
<xm>string</xm>
<xn>string</xn>
<xq>string</xq>
<yxmc>string</yxmc>
</KCInfo>
<KCInfo>
<kcdm>string</kcdm>
<kcmc>string</kcmc>
<xm>string</xm>
<xn>string</xn>
<xq>string</xq>
<yxmc>string</yxmc>
</KCInfo>
</M_GetKCInfoByStudentIDResult>
</M_GetKCInfoByStudentIDResponse>
</soap:Body>
</soap:Envelope>(SoapObject)result.getProperty(i); 这一句获取到第i条<KCInfo>记录
我的返回结果是data table,里面并没有见到任何的soap ,envelope字样。不明白。。
我的返回结果是data table,里面并没有见到任何的soap ,envelope字样。不明白。。