2010-05-02 54 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

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

相關問題