Error requesting the ID of a data in the database through the name STRING of the data

1

Well, I made a method in my webservice to get the ID of a value from a state, that is, I go to function an EX name: "Acre" and it returns the ID in the database of that state. I did it, it worked fine by testing for SOAPUI that is used to test, I wrote "Acre" and it returned me 1, so that's fine ... I was implement in my project.

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String ObjetoDAO.Estado.toString()' on a null object reference                                                                                  at com.example.scartop.photoprint.frmCadastro.CadastroUsuario(frmCadastro.java:112)

Well my DAO method that looks for this data is:

  public Estado buscaIdEstadoPorNome(String nome){
    Estado est = null;

    SoapObject buscarIdEstado = new SoapObject(NAMESPACE, BUSCAR_ID_ESTADO);

    buscarIdEstado.addProperty("nome", nome);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

    envelope.setOutputSoapObject(buscarIdEstado);

    envelope.implicitTypes = true;

    HttpTransportSE http = new HttpTransportSE(URL);

    try {
        http.call("urn: " + BUSCAR_ID_ESTADO, envelope);
        SoapObject resposta = (SoapObject) envelope.getResponse();
        est = new Estado();
        est.setID_ESTADO(Integer.parseInt(resposta.getProperty("ID_ESTADO").toString()));

    } catch (Exception e){
        e.printStackTrace();
        return null;
    }
    return est;
}

I'm using this to return the data:

EstadoDAO estDao = new EstadoDAO();
    Estado est = estDao.buscaIdEstadoPorNome("Acre");
    Log.d("Id Estado: ", est.toString());

Would anyone tell me what's wrong? it's because? Thank you in advance.

    
asked by anonymous 22.05.2016 / 17:13

0 answers