After the web method is called, a XML string is returned as the response.
the android side code is like that :
SoapPrimitive response = (SoapPrimitive) ws.envelope.getResponse();
and the xml is like:
<string xmlns="http://tempuri.org/">
[{"ID":"leo@gmail.com","float_latitude":22.338,"float_longitude":114.169}, {"ID":"emmy@emmy.com","float_latitude":22.33974,"float_longitude":114.169456}, {"ID":"bob@bob.com","float_latitude":22.3384857,"float_longitude":114.1691}, {"ID":"kay@kay.com","float_latitude":50,"float_longitude":100}]
</string>
I want to get
- the number of id returned
- save the lat and long with regards to id to my local variables
O man. First of all your response isn’t XML it is JSON. The way I parse JSON is first build a generic object.
From there build out a collection an arraylist should be fine.
After that do some research into JSON here is some starter code.
pass in the string that gets returned from the server eg response.
iterate through the array
}
Hope this helps