【问题标题】:How to parse soap response from soap object?如何解析来自肥皂对象的肥皂响应?
【发布时间】:2014-05-29 06:30:44
【问题描述】:

如何解析下面的soap响应。特别是对于响应“结果”。请帮我解决这个问题。提前致谢。

响应转储

     <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <soap:Body>
        <RegisterWithEmailIdResponse xmlns="http://tempuri.org/"><RegisterWithEmailIdResult>
<RegisterWithEmailId xmlns="">
                <RegisterWithEmailId>
    <Result>1</Result>
</RegisterWithEmailId>
    </RegisterWithEmailId>
</RegisterWithEmailIdResult>
        </RegisterWithEmailIdResponse>
        </soap:Body>
        </soap:Envelope>

实际反应

anyType{RegisterWithEmailId=anyType{Result=1; }; }

【问题讨论】:

标签: android parsing soap android-ksoap2


【解决方案1】:

终于明白了

anyType{RegisterWithEmailId=anyType{Result=1; }; }

你必须如下解析上面的soap响应

SoapObject res;
                try {
                    res = (SoapObject) result
                            .getProperty("RegisterWithEmailIdResult");
                    res = (SoapObject) res.getProperty("RegisterWithEmailId");
                    res = (SoapObject) res.getProperty("RegisterWithEmailId");
                    state = res.getPropertyAsString(0).toString();

                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多