KSOAP ILLEGAL PROPERTY

Asked

Viewed 179 times

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 (idusuario,username)

Guys, I’m making the following mistake and I can’t fix it :( !

inserir a descrição da imagem aqui

The Method is:

public ArrayList<Usuario> buscarTodosUsuarios() {

    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 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 + "]";
    }

}

1 answer

0

To whom it concerns....

My mistake was that in my webservice was written "idUsuario" and "nounUsuario" and at the time of implementing the customer to consume I was putting:

usr.setIdUsuario(Integer.parseint(soapObject.getProperty("idusuario").toString()); usr.setNomeUsuario(soapObject.getProperty("username").toString());

Basically the mistake was this minute "u"!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.