androidweb-servicesksoap2android-ksoap2ksoap

Accessing primary paramater array in response of a ksoap2 on android


I am using ksoap2 webservice from my android application. I get the following Response from the server:

validateUserResponse{return=anyType{authenticated=true; contactNumber=9856456589; 
***currentAssignedVillagesName=Vavol; currentAssignedVillagesName=Chotila; 
currentVillageCode=6; currentVillageCode=18;*** dob=697228200000; firstTimeLogin=false; 
id=87; languageCode=EN; password=3r68IuRgxV 7lLT6FylQ5bONeimCbehq; 
serverDate=1367224983096; userContactId=163; userRole=Asha; username=umehta; fName=Umang; 
lName=Mehta; }; }

As in the response there is a variable currentAssignedVillagesName which is an array of String and currentVillageCode array of int.

I am unable to access these variables with getProperty() method. Any solution to this.


Solution

  • Yes, just do two things as follows:

    Add a statement as:

    androidHttpTransport.debug = true;
    

    before the call as:

    androidHttpTransport.call(SOAP_ACTION, envelope);
    

    and add statement as:

    String xml = androidHttpTransport.responseDump;
    

    after the call statement, and you will get the response in XML in the form of XML data as tags and data.

    Just parse the data using any parsing method.