KSoap2列表处理 - 这是正确的方法吗?

时间:2010-05-02 12:41:02

标签: android ksoap2

我在glassfish上运行了一个基本的soap服务,它会像这样返回List<String>

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:getNamesResponse xmlns:ns2="http://namespace/">
            <return>Name1</return>
            <return>Name2</return>
        </ns2:getNamesResponse>
    </S:Body>
</S:Envelope>

现在在ksoap2(android)我必须迭代soap-object属性才能恢复我的列表:

SoapObject result = (SoapObject) envelope.bodyIn;

for(int i=0;i<result.getPropertyCount();i++)
{
    list.add(result.getProperty(i));
}

有更好的方法吗?我在实现中找不到任何类映射器。

提前致谢

1 个答案:

答案 0 :(得分:0)

我不敢 - 你需要自己做映射。