ksoap2 网络服务帮助

发布于 2024-11-15 05:12:13 字数 734 浏览 2 评论 0原文

我正在开发事件列表应用程序,应用程序从数据库获取事件,事件到达应用程序正确抛出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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷心人i 2024-11-22 05:12:13

您首先需要解析在您的情况下soapobjects 中的答案是resultsRequestSOAP。如果启用调试,则在变量 at 中您将获得 XML 响应。该 xml 已在 resultsRequestSOAP 对象中进行解析。要回顾一下,您需要执行以下操作:

SoapObject s5 = (SoapObject)resultsRequestSOAP.getProperty(0);
String same=s5.getProperty("name").toString();

在这些之后,您构建对象 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 :

SoapObject s5 = (SoapObject)resultsRequestSOAP.getProperty(0);
String same=s5.getProperty("name").toString();

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文