unexpected end of stream

2

I'm consuming a webservice on android. But I'm having trouble with the following method:

 public static SoapObject Retornar_Lista_UFs(int pCodigo_Entidade) {

    Financeiro_NG oFinanceiro = new Financeiro_NG();

    SoapObject request = new SoapObject(oFinanceiro.WSDL_TARGET_NAMESPACE, oFinanceiro.OPERATION_NAME_UF);
    PropertyInfo pi = new PropertyInfo();
    pi.setName("pCodigo_Entidade");
    pi.setValue(pCodigo_Entidade);
    request.addProperty(pi);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);
    HttpTransportSE httpTransport = new HttpTransportSE(oFinanceiro.SOAP_ADDRESS);

    SoapObject response = null;
    try {
        httpTransport.call(oFinanceiro.SOAP_ACTION_UF, envelope);
        response = (SoapObject) envelope.bodyIn;
    } catch (Exception exception) {
        Log.d("Erro", exception.toString());
    }
    return response;

}

This is a simple method to fetch the UF list from the database. But calling this method on android gives the error unexpected end of stream ; In debug it even shows the list there, and I do not know what that error means. I spent hours looking for a solution.

If you change the envelope.bodyIn to envelope.getResponse() the error continues.

EDIT:

I was able to work around the problem by adding one more catch:

     catch (ProtocolException exception)
    {
        response = (SoapObject) envelope.bodyIn;
    }

So it returns the list if there is the error described, which is clearly not the right thing to do, but I still can not solve the problem.

    
asked by anonymous 25.06.2018 / 15:40

0 answers