我有一个 java web 服务 (soap),我想将它与一个使用 ksoap 的 android 客户端一起使用。
我的网络服务给出了一个如下所示的答案:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:listealbumResponse xmlns:ns2="http://ws/">
<return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:album">
<annee>2008</annee>
<id>6</id>
<titre>Ninja Tuna</titre>
</return>
<return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:album">
<annee>2008</annee>
<id>10</id>
<titre>Fine Music, Vol. 1</titre>
</return>
<return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:album">
<annee>2004</annee>
<id>14</id>
<titre>Bob Acri</titre>
</return>
<return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:album">
<annee>2009</annee>
<id>54</id>
<titre>Rated R</titre>
</return>
</ns2:listealbumResponse>
</S:Body>
</S:Envelope>
这是一个对象列表
要调用我的网络服务,我使用以下代码:
try{
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = false;
envelope.setOutputSoapObject(Request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject result = (SoapObject)envelope.getResponse();
当我测试我的响应“结果”时,它只有一个对象,我如何获取所有列表并解析它?