I am calling a web service in my android app & the method is getGramaNiladhariData(), I am getting the result as a SoapObject.
result = (SoapObject) envelope.
i make own code i just finished it now i would like to share it with u may it help some
i was work with only one table and that was work with me and i will try to explain steps
try {
// Invole web service
androidHttpTransport.call(SOAP_ACTION + "mywebservicecall", envelope);
// Get the response
SoapObject resultsString = (SoapObject) envelope.getResponse();
//resultsString looks like this ==> anyType{schema=anyType{element=anyType{complexType=anyType{choice=anyT....etc
//here i found some complex in getproperty(0) so i not need it
//then i make Object1 that contain datatable from my database getproperty(1)
SoapObject Object1 = (SoapObject) resultsString.getProperty(1);
//object1 look like this ==> anyType{NewDataSet=anyType{Table1=anyType{ID_CAT=1; CAT_V_N=ma
//here my table1 i wanna to fitch the NewDataSet
SoapObject tables = (SoapObject) Object1.getProperty(0); //NewDataset
//tables object now looks like this ==> anyType{Table1=anyType{ID_CAT=1;CAT_N ...etc
//now i wanna loop in my table to get columns valus it will be tablesObject properties depend on iteration to get row by row
for (int i = 0; i < tables.getPropertyCount(); i++) {
SoapObject Objecttable = (SoapObject) tables.getProperty(i);
System.out.println("ID_CAT = " + Objecttable.getProperty("ID_CAT").toString());
System.out.println("CAT_N= " +Objecttable.getProperty("CAT_N").toString());
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("ID_CAT = 0 ");
System.out.println("CAT_N = None");
}
last code explain one table
now what i was just end is how to control multi tables
i will explain it also
SoapObject resultsString = (SoapObject) envelope.getResponse();
// the same
SoapObject Object1 = (SoapObject) resultsString.getProperty(1);
// the same
SoapObject tables = (SoapObject) Object1.getProperty(0);
// the same
// the same
for(int i = 0; i < tables.getPropertyCount(); i++){
SoapObject Objecttable = (SoapObject) (SoapObject) tables.getProperty(i);
try{
//tables.toString().substring(8,tables.toString().indexOf("=")).equals("Table1")
// here i was try to get the name of the table to hundel it but i fount my table name in attribute id
// it not came as table name like if my table that comming from database is hi
//the first row will be attrib=>id=>hi1 and sec row will be hi2
//the first row will be attrib=>rowOrder=>0 and sec row will be 1
if(Objecttable.getAttribute("id").equals("Table1"+(Integer.valueOf(Objecttable.getAttribute("rowOrder").toString())+1))){
// so Objecttable.getAttribute("id") will be ( "Table11" ) in first row
//Objecttable.getAttribute("rowOrder").toString() ==> will be 0
//Integer.valueOf(Objecttable.getAttribute("rowOrder").toString())+1) well be 1 for first row of this table
// so Objecttable.getAttribute("id").equals("Table1"+(Integer.valueOf(Objecttable.getAttribute("rowOrder").toString())+1)) will be true
/**
then i can loop and fitch data like single table
*/
}
if(Objecttable.getAttribute("id").equals("Table2"+(Integer.valueOf(Objecttable.getAttribute("rowOrder").toString())+1))){
}
}catch (Exception e) {
}
hope it's clear for you guys good luck