Question

I have a soap webservice that returns something like this:

ListResult{id=123;
result=ListItem{currencyID=2; currencyISO=EUR; desc=description; hasEMagazine=true; hasPrintMagazine=true; incentiveB=0; incentiveE=1000; objectCatalogID=123; objectID=12345; objectTypeID=1; picURL=url; priceB=222 ; priceRB=anyType{};0 sortID=0; title=title; uniqueProductAttrID=0; };
result=ListItem{currencyID=2; currencyISO=EUR; desc=description; hasEMagazine=true; hasPrintMagazine=true; incentiveB=0; incentiveE=1000; objectCatalogID=123; objectID=12345; objectTypeID=1; picURL=url; priceB=222 ; priceRB=anyType{};0 sortID=0; title=title; uniqueProductAttrID=0; };
result=ListItem{currencyID=2; currencyISO=EUR; desc=description; hasEMagazine=true; hasPrintMagazine=true; incentiveB=0; incentiveE=1000; objectCatalogID=123; objectID=12345; objectTypeID=1; picURL=url; priceB=222 ; priceRB=anyType{};0 sortID=0; title=title; uniqueProductAttrID=0; };

Now I would like to generate a list of Results out of this object. I get a result Object that has 20 Properties and if I retrieve one of this properties I get a SoapPrimitive containing the whole ListItem as a String.

Is there an elegant way to retrieve the needed values from this SoapPrimitive Object without parsing the String manually?

Was it helpful?

Solution 2

I ended up using reflection. I pass in an empty output object an iterate over all the fields to see if one of the fields is contained in the soap result. Have a look at this tutorial for code examples.

OTHER TIPS

Yes there is, see this link

Web Service That Returns An Array of Objects With KSOAP

Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top