Может кто-нибудь сказать мне, как проанализировать вывод SOAP в форме списка?Вот мой код, и я хочу этот вывод в виде списка.
public class WebServices extends Activity
{
private static final String NAMESPACE = "http://www.webserviceX.NET";
private static final String URL = "http://www.webservicex.net/globalweather.asmx";
private static final String SOAP_ACTION = "http://www.webserviceX.NET/GetWeather";
private static final String METHOD_NAME = "GetWeather";
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView textView = new TextView(this);
setContentView(textView);
SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
request.addProperty("CountryName", "India");
request.addProperty("CityName", "Hyderabad");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
httpTransport.debug = true;
try
{
httpTransport.call(SOAP_ACTION, envelope);
Object response = envelope.getResponse();
textView.setText(response.toString());
String str = removeNamespace(response.toString());
Document document = DocumentHelper.parseText(str);
Element ele= document.getRootElement();
List<Element> childlist = ele.elements();
List<String> textList = new ArrayList<String>();
for(Element child : childlist){
textList.add(child.getTextTrim());
}
System.out.print(textList);
}
catch(Exception e)
{
e.printStackTrace();
}
}