2010-05-02 61 views
1

我已经在GlassFish运行的基本SOAP服务,返回List<String>这样KSoap2列表处理 - 这是正确的方法吗?

<?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(机器人),我不得不遍历SOAP对象的属性,让我的列表返回:

SoapObject result = (SoapObject) envelope.bodyIn; 

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

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

在此先感谢

回答

0

恐怕不是 - 你需要自己做映射。

相关问题