如何解析肥皂对象的肥皂反应?

时间:2014-05-29 06:30:44

标签: android parsing soap android-ksoap2

如何解析下面的soap响应。特别是对于回应"结果"。请帮帮我。提前谢谢。

ResponseDump

     <?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的结果= 1; }; }

1 个答案:

答案 0 :(得分:1)

终于搞定了

anyType的{RegisterWithEmailId = {anyType的结果= 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();
                }