I have a wcf ksoap2 service that returns List> as response. Now I have to parse this response
anyType
{
ArrayOfstring=anyType
{
string=Wireless; string=Access Wireless; string=anyType{}; string=anyType{}; string=00001; string=--;
};
ArrayOfstring=anyType
{
string=Wireless; string=Airlink; string=anyType{}; string=anyType{}; string=00003; string=--;
};
ArrayOfstring=anyType
{
string=Long Distance; string=Nobel LD GOT Africa; string=anyType{}; string=anyType{}; string=NBLDAF; string=--;
};
ArrayOfstring=anyType
{
string=Long Distance; string=STI LD Smash; string=anyType{}; string=anyType{}; string=00028; string=--;
};
ArrayOfstring=anyType
{
string=International TopUp; string=Afghanistan Etisalat Top-Up $2-$75; string=Hussain; string=0345339; string=ETIAFG; string=--;
};
ArrayOfstring=anyType
{
string=International TopUp; string=Afghanistan Etisalat Top-Up $2-$75; string=Hussain; string=0345339; string=ETIAFG; string=--;
};
ArrayOfstring=anyType
{
string=International TopUp; string=Bolivia Viva Top-Up $5 - $75; string=Hussain; string=0345339; string=VIVABO; string=--;
};
ArrayOfstring=anyType
{
string=International TopUp; string=Bolivia Viva Top-Up $5 - $75; string=Hussain; string=0345339; string=VIVABO; string=--;
};
ArrayOfstring=anyType
{
string=International TopUp; string=Peru Movistar Top-Up $5 - $75; string=Hussain; string=0345339; string=anyType{}; string=--;
};
}
I know how to parse a response that returns List. I was using this code
HttpTransportSE htp = new HttpTransportSE(URL);
htp.call(SOAP_ACTION, soapEnvelop);
response = (SoapObject) soapEnvelop.getResponse();
if (response != null) {
if (response.getPropertyCount() > 0) {
InternationalTopup.arr_Items = new String[response
.getPropertyCount()];
for (int i = 0; i < response.getPropertyCount(); i++) {
InternationalTopup.arr_Items[i] = response.getProperty(
i).toString();
}
}
}
but I have no idea how to parse the above response. Do i have to use Json? Please provide some examples and share your experience. Any help will be appreciated. thanks
If you service built on WCF and if you can return json, then you don't need to use KSoap. There's a detail example, in my blog. Please refer this