Reputation: 966
I have a webservice that returns a complex object(say RouteDetails).when i am calling this webservice from my android code in which i have used ksoap library i am getting a response in soapobject but when i try to cast it to my complex object it throws classcast exception while when i print it on log it show me output like this -
" RuoteDetails{name="abc",id="2"} "
where RouteDetails is my object Now i am completely unaware of how to retrieve my object . Can any one please help. i hav gone through various links but couldnt find a proper solution.
Upvotes: 2
Views: 443
Reputation: 6522
Ksoap2 can parse response into several types of objects.
SoapObject
- the default one. You can use its methods getProperty
, getPropertySafely
, getPropertyAsString
and so on for getting data. i.e
String value = response.getPropertySafelyAsString("propertyName", "default");
KvmSerializable
interface and registered by addMaping(). In the last two cases you will get your object from envelope.getResponse()
(in the first case your will get SoapObject).
So you can get your data from SoapObject
or implement KvmSerializable
or Marshal
interfaces and register your class.
Upvotes: 1