KSoap2 list handling - is this the correct way?

Posted by oozoo on Stack Overflow See other posts from Stack Overflow or by oozoo
Published on 2010-05-02T12:41:01Z Indexed on 2010/05/02 12:47 UTC
Read the original article Hit count: 534

Filed under:
|

Hello, ksoap-newbie here

I have a basic soap service running on glassfish, that returns List<String> like this

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:getNamesResponse xmlns:ns2="http://namespace/">
            <return>Name1</return>
            <return>Name2</return>
        </ns2:getNamesResponse>
    </S:Body>
</S:Envelope>

now in ksoap2 (android) I have to iterate the soap-object properties to get my list back:

SoapObject result = (SoapObject) envelope.bodyIn;

for(int i=0;i<result.getPropertyCount();i++)
{
    list.add(result.getProperty(i));
}

is there a better way? I couldn't find any class mapper in my implementation.

thanks in advance

© Stack Overflow or respective owner

Related posts about ksoap2

Related posts about android