Object sent by Android arriving Null on the WebService server

0

I'm creating an Android APP for college work, I'm using Android Studio and Eclipse Mars with Glassfish 4.

The webservice I believe to be okay, because realizing the requests by SoapUI everything works right, but at the time of consuming with Android Studio, the object that arrives at the server is Null.

Here is the code used for Android calling in Android Studio:

        public boolean inserirUsuario(Cliente cliente){

        SoapObject inserirUsuario = new SoapObject(NAMESPACE, INSERIR);

        SoapObject user = new SoapObject(NAMESPACE, "cliente");

        user.addProperty("id", cliente.getId());
        user.addProperty("cpf", cliente.getCpf());
        user.addProperty("primeiroNome", cliente.getPrimeiroNome());
        user.addProperty("sobrenome", cliente.getSobrenome());
        user.addProperty("email", cliente.getEmail());
        user.addProperty("senha", cliente.getSenha());
        user.addProperty("ddd", cliente.getDdd());
        user.addProperty("telefone", cliente.getTelefone());
        user.addProperty("ativo", cliente.isAtivo());

        inserirUsuario.addSoapObject(user);

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

        envelope.setOutputSoapObject(inserirUsuario);

        envelope.implicitTypes = true;

        HttpTransportSE http = new HttpTransportSE(URL);

        try {
            http.call("\"urn:inserirUsuario\"", envelope);

            SoapPrimitive resposta = (SoapPrimitive) envelope.getResponse();

            return Boolean.parseBoolean(resposta.toString());
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

I have tried to get the "user" and only send the "insertUsuario", however of both manners the objects are arriving Null in the server.

Has anyone ever had a similar problem and can you help me with the solution?

    
asked by anonymous 25.03.2016 / 19:03

2 answers

0

I've never used soap on android. But I'd advise you to take a look at link

Turn on debug logging on httptransport and see what is coming out. This way you might be able to detect the problem.

happy coding:)

    
26.03.2016 / 12:06
0

Make a request for your webservice using the postman and see if the object will get null. If it arrives you will know that the problem is not at the beginning in android.

Also try to print the object being sent to see if it is no longer empty at the start of the upload.

    
26.03.2016 / 14:31