I have a Web service that returns this data:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<LISTACLIENTESRESPONSE xmlns="http://localhost:8093/">
<LISTACLIENTESRESULT>
<ACLIENTE>
<STCLIENTE>
<CCODIGO>000001</CCODIGO>
<CRAZAO>PEDRO DA SILVA</CRAZAO>
<CMUNICIPIO>SAO PAULO</CMUNICIPIO>
<CVENDEDOR>JOAO</CVENDEDOR>
</STCLIENTE>
<STCLIENTE>
<CCODIGO>000002</CCODIGO>
<CRAZAO>JOSE</CRAZAO>
<CMUNICIPIO>SAO PAULO</CMUNICIPIO>
<CVENDEDOR>PAULO</CVENDEDOR>
</STCLIENTE>
<STCLIENTE>
<CCODIGO>000003</CCODIGO>
<CRAZAO>LETICIA</CRAZAO>
<CMUNICIPIO>SAO PAULO</CMUNICIPIO>
<CVENDEDOR>PEDRO</CVENDEDOR>
</STCLIENTE>
</ACLIENTE>
<CMENSAGEM>3 Clientes Localizados</CMENSAGEM>
</LISTACLIENTESRESULT>
</LISTACLIENTESRESPONSE>
</soap:Body>
</soap:Envelope>
In my Android studio project, I can connect and send the data to WS but I am not understanding how to retrieve the data provided by WS.
envelope.setOutputSoapObject(buscarClientes);//Metodo esta correto
HttpTransportSE http = new HttpTransportSE(URL);
try {
SoapObject soapObject =
(SoapObject)resposta.getProperty("ACLIENTE");
for(int i = 0; i < soapObject.getPropertyCount(); i++) {
soapObject.getProperty(1).toString());
Cliente cliente = new Cliente();
cliente.setCodigo(soapObject.getProperty("CCODIGO").toString());
cliente.setRazao(soapObject.getProperty("CRAZAO").toString());
cliente.setMun(soapObject.getProperty("CMUNICIPIO").toString());
listaClientes.add(cliente);
}
} catch (Exception e){
return listaClientes;
}
How do I recover this data? Return is an array of clients and a message.
I ran this code:
SoapObject resposta = (SoapObject) envelope.getResponse();
String clientes = envelope.getResponse().toString();
Log.i("CLIENTE",clientes);
The return in the Log was this: anyType {ACLIENT = anyType {STCLIENTE = anyType {CCODIGO = 000819; COMPANY = SAO PAULO; CRAZY = CLIENT; CVENDEDOR = FIR1; }; STCLIENT = anyType {CCODIGO = 001951; CMUNICIPIO = SANTOS; CRAZAO = CUSTOMER 2; CVENDEDOR = FIR2; };} CMENSAGE = 2 Localized Clients.
You have returned all data from the Web Service.