An error occurred while sending the request

Asked

Viewed 241 times

1

I am generating a batch xml of rps, and to envelop, and add ![CDATA[ he jumps line, I thought it was something with the registers, but I managed lot of only one rps, one by one, to see if it would give this same problem, but it did not, and when I add all, he jumps line, it is this way:

inserir a descrição da imagem aqui

Someone can help me, for this to happen?

I think it may be some character that is making you skip the line, but until then I don’t know what it might be. This occurred in the second generation.

I use this code:

 string soapEnvelope = string.Empty;

        var item = db.Empresas.SingleOrDefault(t => t.Id == idempresa);
        soapEnvelope += "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tns=\"http://www.betha.com.br/e-nota-contribuinte-ws\">";
        soapEnvelope += "<S:Body><tns:" + ws + "><nfseCabecMsg><![CDATA[";
        soapEnvelope += CabecMsg;
        soapEnvelope += "]]></nfseCabecMsg><nfseDadosMsg><![CDATA[";
        soapEnvelope += document.LastChild.OuterXml.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", string.Empty);
        soapEnvelope += "]]></nfseDadosMsg></tns:" + ws + "></S:Body></S:Envelope>";
        MemoryStream stream = stringToStream(soapEnvelope.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", string.Empty));
        webRequest.ContentLength = stream.Length;
        Stream requestStream = webRequest.GetRequestStream();
        stream.WriteTo(requestStream);

        document.LoadXml(soapEnvelope);

        document.PreserveWhitespace = false;
        document.Save(caminho);
        System.Xml.Linq.XDocument doc = System.Xml.Linq.XDocument.Load(caminho);
        doc.Save(caminho, System.Xml.Linq.SaveOptions.DisableFormatting);

        this.XmlDocNFSe = document;

Shouldn’t be breaking line.

  • 1

    I imagine this line break is only because of the visualization in the browser. Try opening xml with a simple text editor and check if it is generating space or break line.

  • @Wagnersoares in the text editor is also skipping line.

No answers

Browser other questions tagged

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