07-16-2012 11:11 AM - edited 07-16-2012 11:13 AM
I have a problem with a WebService. I can only read the first webservice's line.
int num=root.getPropertyCount(); This line returns a 1.
My XML is this.
<?xml version="1.0" encoding="utf-8" ?> - <mensajes> - <nodo0> <Asunto>Asunto 1</Asunto> <Descripcion>Descripcion 1</Descripcion> <Fecha>viernes, 06 de julio de 2012</Fecha> </nodo0> - <nodo1> <Asunto>Asunto 2</Asunto> <Descripcion>Descripcion 2</Descripcion> <Fecha>viernes, 06 de julio de 2012</Fecha> </nodo1> - <nodo2> <Asunto>Asunto</Asunto> <Descripcion>Descripcion3</Descripcion> <Fecha>viernes, 06 de julio de 2012</Fecha> </nodo2> </mensajes>
My code to get the xml is this:
SoapObject result = (SoapObject) envelope.bodyIn;
SoapObject root=(SoapObject)result.getProperty("GetXMLResult" );
int num=root.getPropertyCount();
for (int i = 0; i < num; i++)
{
SoapObject s_deals = (SoapObject) root.getProperty(i);
Object property = s_deals.getProperty(i);
if (property instanceof SoapObject)
{
SoapObject category_list = (SoapObject) property;
String Asunto = category_list.getProperty("Asunto").toString();
String Descripcion = category_list.getProperty("Descripcion").toString( );
String Fecha = category_list.getProperty("Fecha").toString();
}
}
anyType{mensajes=anyType{nodo0={anyType={Asunto=As unto1;Descripcion=Descripcion1};}
nodo1={anyType={Asunto=Asunto2;Descripcion=Descrip cion2};}}