I am using KSOAP2 (3.0.0) getting a response like the following:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" >
<env:Header>
</env:Header>
<env:Body>
<ns2:ExampleResponse xmlns:ns2="http://example.com/" >
<result>
<answer>0</answer>
<message>
<last>0</last>
</message>
</result>
</ns2:ExampleResponse>
</env:Body>
</env:Envelope>
I want to capture "last, I used the following:
String ans1 = response.getPropertyAsString("answer"); // 0
String ans2 = response.getPropertyAsString("message"); // anyType{last=0; }
String ans3 = response.getPropertyAsString("last"); // illegal property: last
As shown is just working "answer". How can I get "last"?
Could you try following:
// Fetches message as soap object, rather than just its string representation
SoapObject messageObject = (SoapObject) response.getProperty("message");
// Fetches last from above oject
String lastAsString = messageObject.getPropertyAsString("last");
Hope it helps!