我的Web服务返回List中的多个数组。此列表中包含三个数组。如何在android中定义的数组中获取这些数组。我想将soap响应转换为包含三个数组的列表,以保存Web服务返回的数组。我怎样才能做到这一点?有什么建议? 这是我的代码:
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("location",location);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true; // put this only if the web service is .NET one
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
try{
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject response = (SoapObject)envelope.getResponse();
int count = response.getPropertyCount();;
ArrayList<String> resname = new ArrayList<String>();
ArrayList<String> resloc = new ArrayList<String>();
ArrayList<String> resid = new ArrayList<String>();
for (int i = 0; i < count; i++)
{
///here first array returns data to be stored in resname for i=0. but for the next iteration i have to add data to resloc and for third iteration i.e i=2, i have to store data in resid. how to do this?
SoapObject soapresults = (SoapObject)response.getProperty(i);
resname.add(soapresults.getPropertyAsString(i));
}