I'm having a problem consuming my webservice.
I have the following method (This method will return all the users registered in the webservice that are in the database) User owns (id, name):
public ArrayList<Usuario> buscarTodosUsuario(){
ArrayList<Usuario> lista = new ArrayList<Usuario>();
SoapObject buscarUsuario = new SoapObject(NAMESPACE, BUSCARTODOS);
SoapSerializationEnvelope envelope= new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(buscarUsuario);
envelope.implicitTypes = true;
HttpTransportSE http = new HttpTransportSE(URL);
try {
http.call("urn= " + BUSCARTODOS, envelope);
Vector<SoapObject> resposta = (Vector<SoapObject>) envelope.getResponse();
for (SoapObject soapObject : resposta) {
Usuario user = new Usuario();
user.setIdUsuario(Integer.parseInt(soapObject.getProperty("id").toString()));
user.setNome(soapObject.getProperty("nome").toString());
lista.add(user);
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return lista;
}
The method call is:
ArrayList<Usuario> lista = dao.buscarTodosUsuario();
Log.d("ExemploWS", lista + "");
The error is:
TheUserclassis:
packagecom.example.testawebservice;publicclassUsuario{privateintid;privateStringnomeusuario;publicUsuario(){}publicUsuario(intid,Stringnomeusuario){super();this.id=id;this.nomeusuario=nomeusuario;}publicintgetIdUsuario(){returnid;}publicvoidsetIdUsuario(intid){this.id=id;}publicStringgetNome(){returnnomeusuario;}publicvoidsetNome(Stringnomeusuario){this.nomeusuario=nomeusuario;}@OverridepublicStringtoString(){return"Usuario [id=" + id + ", nomeusuario="
+ nomeusuario + "]";
}
}