android无法获取webservice返回的复杂类型数组 本帖最后由 wushuangman1127 于 2013-07-03 09:30:25 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 貌似webservice只能是返回简单类型的数据,你们自己定义一个格式 ,还是通过string返回,然后按照格式解析不就行了吗 你获取的返回值通过 envelope.getResponse(); 获取 我没用过这种方式。这是我们之前用的方式 返回的是字符串,但格式是json格式HttpTransportSE hts = new HttpTransportSE(URL + serviceName, TIME_OUT); // 启用调试 hts.debug = true; SoapSerializationEnvelope sse = new SoapSerializationEnvelope(SoapEnvelope.VER11); sse.dotNet = true; sse.bodyOut = request; hts.call(NAME_SPACE + nsService + method, sse); // 返回结果 SoapObject response = null; response = (SoapObject) sse.bodyIn; String result = null; try { result = response.getProperty(0).toString(); } catch (Exception e) { throw new UnknowException("返回数据为空"); }返回通过sse.bodyIn这个方式获取 ,你试试呢,如果response 不为null,解析就简单了撒 刚开始用getResponse()方法抛出Vector cannot cast to SoapObject异常,之后改成bodyIn获取返回值就没用问题了。谢谢各位的热心解答。不胜感激! android游戏开发--三国无双 在线等,一个 Run Configuration问题 Android 代码问题 请教写法 为什么我Run的时候总会出现这种错误呢? Android 和 PC的通信 ? 用layout函数移动控件问题 checkbox怎么设置背景图片自适应 WebView加载html 应用点击home键的问题 请问微信等是如何分析用户是否通过模拟器登录 关于移动终端应用服务器地址的问题? 怎么实现类似360手机助手下载管理的界面
这是我们之前用的方式 返回的是字符串,但格式是json格式HttpTransportSE hts = new HttpTransportSE(URL + serviceName, TIME_OUT);
// 启用调试
hts.debug = true;
SoapSerializationEnvelope sse = new SoapSerializationEnvelope(SoapEnvelope.VER11);
sse.dotNet = true;
sse.bodyOut = request;
hts.call(NAME_SPACE + nsService + method, sse);
// 返回结果
SoapObject response = null;
response = (SoapObject) sse.bodyIn;
String result = null;
try {
result = response.getProperty(0).toString();
} catch (Exception e) {
throw new UnknowException("返回数据为空");
}
返回通过sse.bodyIn这个方式获取 ,你试试呢,如果response 不为null,解析就简单了撒