I am trying to parse a soap call response and cast it to a complex object, but I it does not work. My request is the following:
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header/>
<S:Body>
<ns2:checkUserLogin xmlns:ns2="http://ServerFacade/">
<username>name</username>
<password>pass</password>
</ns2:checkUserLogin>
</S:Body>
</S:Envelope>
And my response looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:checkUserLoginResponse xmlns:ns2="http://ServerFacade/">
<return>
<message>Login erfolgreich!</message>
<msgType>1</msgType>
</return>
</ns2:checkUserLoginResponse>
</S:Body>
</S:Envelope>
I created a class named ServerMessageStruct, which is implementing the KVMSerializable interface. It has two attributes, message and msgType. Now I am trying to parse this response, but I am not sure if I understood it quite right... I am trying to do this:
ServerMessageStruct dataStruct = (ServerMessageStruct) soapEnvelope.getResponse();
This ends in a ClassCatException... and when I try to do it like this...
SoapObject so = (SoapObject) soapEnvelope.getResponse();
ServerMessageStruct dataStruct = (ServerMessageStruct) so.getProperty("checkUserLogin");
I get an exception because of an unknown property...
What do I do wrong? What am I missing to get this to work? If you need more detailed Information, please let me know...
best regards,
Jens