如何解析从Android的SOAP信封对象数据 [英] how to parse data from Soap envelope object in android

查看:326
本文介绍了如何解析从Android的SOAP信封对象数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SoapObject result = (SoapObject) envelope.getResponse();
SoapObject root = (SoapObject) result.getProperty(0);
SoapObject s_deals = (SoapObject) root.getProperty("InfraWiseDetails");
SoapObject s_deals_1 = (SoapObject) s_deals.getProperty("VisitInfraDetails");

for (int i = 0; i < s_deals_1.getPropertyCount(); i++) {
    Object property = s_deals_1.getProperty(i);

    if (property instanceof SoapObject) {
        SoapObject category_list = (SoapObject) property;
        String x = category_list.getProperty("Feedback").toString();
        String y = category_list.getProperty("InfraName").toString();
        String z = category_list.getProperty("Problem").toString();
    }
}

这是我的code

SoapObject SoapObject结果=(SoapObject)envelope.getResponse(); 我得到回应--->

in SoapObject SoapObject result = (SoapObject) envelope.getResponse(); i am getting response --->

anyType{InfraWiseDetails=anyType{VisitInfraDetails=anyType{Feedback=Status OK; InfraName=Tables and Chairs; Problem=null; ResolutionStatus=false; Status=true; };

VisitInfraDetails=anyType{Feedback=Water Quality very poor; InfraName=Water; Problem=Rust in Water; ResolutionStatus=false; Status=false; }; }; VisitMasterId=1; }

我想从给定的SoapObject解析数据,并得到反馈的所有价值,Infraname,问题... 请告诉我,我做错了,我不能让值

推荐答案

在很长一段时间我期待在ksoap2 code。试试这个:

After long time i am looking on ksoap2 code. Try this :

SoapObject result = (SoapObject) envelope.getResponse();
SoapObject root = (SoapObject) result.getProperty(0);
SoapObject s_deals = (SoapObject) root.getProperty("InfraWiseDetails");

for (int i = 0; i < s_deals.getPropertyCount(); i++) {
    SoapObject s_deals_1 = (SoapObject) s_deals.getProperty(i);
    String x = s_deals_1.getProperty("Feedback").toString();
    String y = s_deals_1.getProperty("InfraName").toString();
    String z = s_deals_1.getProperty("Problem").toString();   
}

这篇关于如何解析从Android的SOAP信封对象数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆