Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 1
Registered: ‎07-16-2012
My Device: 9800
My Carrier: Developer

Read a xml in webservice

[ Edited ]

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>
- <nodo1>
  <Asunto>Asunto 2</Asunto>
  <Descripcion>Descripcion 2</Descripcion>
  <Fecha>viernes, 06 de julio de 2012</Fecha>
- <nodo2>
  <Fecha>viernes, 06 de julio de 2012</Fecha>

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();