Good afternoon
I'm in a development of an app that consumes webservices, the point is that he sends me a menu method that is an xml, I need to read it and show it as a menu in my app, I'm looking to show it in a listview, but not I know how to do the parse, they could help me explain ... now I have my connection to the webservices and it brings me the data, I was already doing it in another way but when the background method ends it does not happen to execute to fill my listview .. help me
webservices code, I have this code in a class called webservices (invoke)
public static ArrayList Menu() {
// Create request
SoapObject request = new SoapObject("http://oncontrol.no-ip.net:9020/","Menu");
// Property which holds input parameters
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.implicitTypes=false;
// Set output SOAP object
envelope.setOutputSoapObject(request);
// Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL,7000);
ArrayList MenuArray = new ArrayList();
//ArrayAdapter<String> arrayadapter;
try {
androidHttpTransport.debug=true;
// Invoke web service
androidHttpTransport.call("http://oncontrol.no-ip.net:9020/Menu", envelope);
String ss=androidHttpTransport.responseDump;
// Get the response
// SoapObject obj1 = (SoapObject) envelope.bodyIn;
// SoapObject obj2 = (SoapObject) obj1.getProperty(0);
SoapObject response = (SoapObject)envelope.getResponse();
SoapObject obj1 = (SoapObject) envelope.getResponse();
SoapObject obj2 =(SoapObject) obj1.getProperty(1);
SoapObject obj3 =(SoapObject) obj2.getProperty(0);
for(int i=0; i<obj3.getPropertyCount(); i++)
{
SoapObject obj4 =(SoapObject) obj3.getProperty(i);
int id= Integer.parseInt(obj4.getProperty("Id").toString());
String Descripcion = obj4.getProperty("Descripcion").toString();
MenuArray.add(i,Descripcion);
}
} catch (Exception e) {
//Assign Error Status true in static variable 'errored'
//menu.errored = true;
e.printStackTrace();
}
//Return booleam to calling object
//return loginStatus;
return MenuArray;
}
}