Search code examples
javaandroidksoap2

send a type complex Soap error org.xmlpull.v1.XmlPullParserException: expected: START_TAG


I'm doing a method to update customer master data, but when I walk by this method I'm having trouble sending the object, someone has seen this problem?

following code

 public String atuzalizarCadastroCliente(DadosCadastraisSeralizable dados) throws IOException, XmlPullParserException {
        SoapObject request = new SoapObject("urn:RouterBoxMobile", "AtualizarCadastroClientes");



        SoapObject chaveIntegracao = new  SoapObject("urn:RouterBoxMobile", "AtualizarCadastroClientes");
        chaveIntegracao.addProperty("ChaveIntegracao",chaveDeIntegracao);

        request.addProperty("Autenticacao", chaveIntegracao);
        request.addProperty("DadosAtualizadosClientes",dados);


        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.setOutputSoapObject(request);


        envelope.implicitTypes=true;



         httpTransportSE = new HttpTransportSE(URL_WEBSERVICE);
         httpTransportSE.debug=true;

         httpTransportSE.call("",envelope);





        SoapObject  response = (SoapObject) envelope.getResponse();
        //resposta=envelope.getResponse();

        return response.toString();


    }

error log:

11-07 11:31:19.726 19420-19701/routerbox.com.br.centraisdoassinante W/System.err: org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG (empty) <br>@1:7 in java.io.InputStreamReader@527e5270) 
11-07 11:31:19.726 19420-19701/routerbox.com.br.centraisdoassinante W/System.err:     at org.kxml2.io.KXmlParser.require(KXmlParser.java:2046)
11-07 11:31:19.726 19420-19701/routerbox.com.br.centraisdoassinante W/System.err:     at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:127)

Solution

  • solved problem was having to send the complex type DadosAtualizadosClientes:

     public String atuzalizarCadastroCliente(DadosCadastraisSerealizable dados){
            SoapObject request = new SoapObject("urn:RouterBoxMobile","AtualizarCadastroClientes");
    
            SoapObject chaveIntegracao = new SoapObject("urn:RouterBoxMobile","Autenticacao");
            chaveIntegracao.addProperty("ChaveIntegracao",chaveDeIntegracao);
            request.addProperty("Autenticacao", chaveIntegracao);
    
    
            SoapObject dadosAtualizadosClientes = new SoapObject("urn:RouterBoxMobile", "DadosAtualizadosClientes");
            dadosAtualizadosClientes.addProperty("CodigoCliente",dados.codigo);
            dadosAtualizadosClientes.addProperty("Usuario",dados.usuario);
            dadosAtualizadosClientes.addProperty("Senha",dados.senha);
            dadosAtualizadosClientes.addProperty("CEP",dados.cep);
            dadosAtualizadosClientes.addProperty("Bairro",dados.bairro);
            dadosAtualizadosClientes.addProperty("Endereco",dados.endereco);
            dadosAtualizadosClientes.addProperty("Numero",dados.numero);
            dadosAtualizadosClientes.addProperty("Complemento",dados.complemento);
            dadosAtualizadosClientes.addProperty("TelComercial",dados.foneComercial);
            dadosAtualizadosClientes.addProperty("TelResidencial",dados.foneResidencial);
            dadosAtualizadosClientes.addProperty("TelCelular",dados.foneCelular);
            dadosAtualizadosClientes.addProperty("Email",dados.email);
    
            request.addProperty("DadosAtualizadosClientes",dadosAtualizadosClientes);
    
    
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.setOutputSoapObject(request);
    
    
            HttpTransportSE httpTransportSE = new HttpTransportSE(URL_WEBSERVICE);
            httpTransportSE.debug=true;
    
    
            try {
                httpTransportSE.call("",envelope);
                Log.d("Response",httpTransportSE.requestDump.toString());
    
    
                SoapObject  response = (SoapObject) envelope.getResponse();
    
    
            } catch (IOException e) {
                e.printStackTrace();
            } catch (XmlPullParserException e) {
                e.printStackTrace();
            }
           return null;
        }