KSOAP ILLEGAL PROPERTY [duplicate]

0

I made the webservice using Android and KSOAP, now I need to consume the webservice ... The specified method needs to recover all users from the database (userid, username)

Personal, I have the following error and I do not know how to solve :(!

TheMethodis:

publicArrayList<Usuario>buscarTodosUsuarios(){ArrayList<Usuario>lista=newArrayList<Usuario>();SoapObjectbuscarUsuario=newSoapObject(NAMESPACE,BUSCARTODOS);SoapSerializationEnvelopeenvelope=newSoapSerializationEnvelope(SoapEnvelope.VER11);envelope.setOutputSoapObject(buscarUsuario);envelope.implicitTypes=true;HttpTransportSEhttp=newHttpTransportSE(URL);try{http.call("urn= "  + BUSCARTODOS, envelope);

        Vector<SoapObject> resposta = (Vector<SoapObject>) envelope.getResponse();

        for (SoapObject soapObject : resposta) {

            Usuario usr = new Usuario();

            usr.setIdUsuario(Integer.parseInt(soapObject.getProperty("idusuario").toString()));
            usr.setNomeUsuario(soapObject.getProperty("nomeusuario").toString());

            lista.add(usr);
        }

    } catch (Exception e) {

        e.printStackTrace();
        return null;
    }
        return lista;

}

The class Usuario is:

public class Usuario {
    private int idusuario;
    private String nomeusuario;


    public Usuario(){

    }

    public Usuario(int idusuario, String nomeusuario) {
        super();
        this.idusuario = idusuario;
        this.nomeusuario = nomeusuario;
    }

    public int getIdUsuario() {
        return idusuario;
    }

    public void setIdUsuario(int idusuario) {
        this.idusuario = idusuario;
    }

    public String getNomeUsuario() {
        return nomeusuario;
    }

    public void setNomeUsuario(String nomeusuario) {
        this.nomeusuario = nomeusuario;
    }



    @Override
    public String toString() {
        return "Usuario [idusuario=" + idusuario + ", nomeusuario="
                + nomeusuario + "]";
    }

}
    
asked by anonymous 10.04.2015 / 00:28

1 answer

0

For those who care ....

My error was that in my webservice it was written "idUsuario" and "username" and at the time of implementing the client to consume I was putting:

usr.setIdUsuario (Integer.parseInt (soapObject.getProperty (" idusuario ").) toString ())); toString ());

Basically the mistake was this tiny "u"!

    
10.04.2015 / 00:38