Possible duplicate:
Analysis of ksoap2 answer
So I managed to call the web service using KSoap2 in android, but I can not find a way to parse the answer ...
So here what I receive from the webservice
anyType{
WORCCategoriaSubcategoriaRecord=anyType{ssENCategoria=anyType{Id=1; Nome=Problema na rua; }; ssENSubcategoria=anyType{Id=1; Nome=Falta de acesso; Imagem=anyType{}; CategoriaId=1; }; };
WORCCategoriaSubcategoriaRecord=anyType{ssENCategoria=anyType{Id=1; Nome=Problema na rua; }; ssENSubcategoria=anyType{Id=2; Nome=Falta de Passadeira; Imagem=anyType{}; CategoriaId=1; }; };
}
And here is the code that I use to call the web service ...
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.setOutputSoapObject(request);
soapEnvelope.dotNet = true;
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
try{
aht.call(SOAP_ACTION, soapEnvelope);
SoapObject resultsRequestSOAP = (SoapObject) soapEnvelope.bodyIn;
int elementCount = resultsRequestSOAP.getPropertyCount();
if(elementCount>0){
SoapObject element;
for(int i = 0;i<elementCount;i++){
element = (SoapObject)resultsRequestSOAP.getProperty(i);
}
}
}catch(Exception ex){
ex.printStackTrace();
}
Is there a way to easily "parse" it, without having any property "manually"? something like an XML parser ...
source
share