ksoap2 网络服务帮助
我正在开发事件列表应用程序,应用程序从数据库获取事件,事件到达应用程序正确抛出webservice,但我的问题是在listview的适配器中绑定soap对象,我这样做了,
try {
aht.call(SOAP_ACTION, envelope);
resultsRequestSOAP = (SoapObject) envelope.getResponse();
// rs = (SoapPrimitive) envelope.getResponse();
// resultString = (List<UBAEvent>)envelope.getResponse();
} catch (Exception e) {
e.printStackTrace();
}
int x = resultsRequestSOAP.getPropertyCount();
adapter = new MyArrayAdapter(this);
UBAEvent ubaEvent = new UBAEvent();
for (int i = 0; i < x; i++) {
ubaEvent = (UBAEvent) resultsRequestSOAP.getProperty(i);
adapter.add(ubaEvent);
}
但它不是任何人都可以帮助我如何将肥皂对象绑定到适配器中吗?
i am working on application for events listing , the application get the events from the database , the events arrive to the application throw webservice correctly , but my problem is to bind the soap object in adapter of the listview , i do this
try {
aht.call(SOAP_ACTION, envelope);
resultsRequestSOAP = (SoapObject) envelope.getResponse();
// rs = (SoapPrimitive) envelope.getResponse();
// resultString = (List<UBAEvent>)envelope.getResponse();
} catch (Exception e) {
e.printStackTrace();
}
int x = resultsRequestSOAP.getPropertyCount();
adapter = new MyArrayAdapter(this);
UBAEvent ubaEvent = new UBAEvent();
for (int i = 0; i < x; i++) {
ubaEvent = (UBAEvent) resultsRequestSOAP.getProperty(i);
adapter.add(ubaEvent);
}
but it is not work can any one help me how to bind the soap object into adapter ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您首先需要解析在您的情况下soapobjects 中的答案是resultsRequestSOAP。如果启用调试,则在变量 at 中您将获得 XML 响应。该 xml 已在 resultsRequestSOAP 对象中进行解析。要回顾一下,您需要执行以下操作:
在这些之后,您构建对象 ubaEvent 您尝试复杂类型,所以我知道的最好方法是这些,或者您可以尝试序列化的困难方法
You first need to parse the answer ok that is in soapobjects in your case is resultsRequestSOAP. If you enable debug, in variable aht you have the XML response. And that xml is already parsed in resultsRequestSOAP object. To retreview you do these :
after these you build the object ubaEvent you trying complex types so best way i know is these one or you can try the hard way with serialization