Content Not Allowed in Prolog, even though XML is perfectly formatted

Asked

Viewed 413 times

0

So, I’ve been trying to send an XML to a Southern Sapucaia Webservice, RS. XML requests the printing of a PNG-shaped Nfse. The problem is that XML is sent and as a return I receive a message stating "Content Not Allowed in Prolog", and the problem is that I have no idea what has gone wrong in prologo of this XML. It looks formatted perfectly! I must inform you that the code in Java that creates the XML and sends it takes the XML in string form and saves it in a ".xml file" which is then taken by the code and sent. Follow the XML itself for analysis.

<?xml version="1.0" encoding="UTF-8"?>
<pedidoNFSePNG versao="1.0">
<CNPJ>05545465000141</CNPJ>
<chvAcessoNFS-e>43055454650001419000S000000853400901798</chvAcessoNFS-e>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>zA8sttM5PTXhp/+LCyErKZkP7+I=</DigestValue>
</Reference>
</SignedInfo><SignatureValue>K/pJlIkg6CZLIL4gS4dTHQ0Eqld4bliRUhqPPmMvlWYvK6B53HDVdCgfMGbhAKTkDx+BeF9V/bjN Wev8LNru0st6ory+Lb59S7fDquxYyHKxErRJgBlTeO7bVrtzK60ItTPuCXvP7ldfxelNloJPBvHC A1hHS4yPZ2PE8VjFgrndqIIi0kbvBJq5eAHy6FhF/kg8qP9zbsr5FGHDj65TXw+EgXiwETrOVXI7 ufRNZXLDRCg2LEKf9KxU7lNyPh79coZlegBmBG3quK2jsNXpEWxOpuxbxgSqeygXBA+TOrmK3VnO F/WBM++rL3FUSg2DUH4ctCHHIHP/qlcNN0i5dQ==</SignatureValue>
<KeyIn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BcFYrhHz6rxledtM+2c5WeA6LyrnQx3Jhg1h6uJiRaGp YYoFmtSaZYjjKa+HJo7/tVxturweEFrwrhhoT//yAFrRyFju7DqYJ9qr7DpP29xhbs2eQncqm5+p rTFfZ5cpX+lC2589eQE4U1UZQ3oMtg9shL7bRjz0SAf1/bIxI1xFvGa2pBVlNDCtH1h/EjIK62oq 1n0J+TCfaqGLA00wb4Qx/f9SasA7RfV6H4eB3aiXKcVVpdkXLHutb94epOsgQ3r/QOjhDq+G7mOG LGY2vRVscTTmwbPSuVzKx17WQdGe9ke9HTPF+KMd67rxUaeF3/vGGqjcP8le3sQfszv3j8j31FWx kT5fLsgh9Vx8o6FFqgGt1mV0eKIIJSzXHt+29QtObTxjv24YQOW3YJ2vba4gGLdCvHs2Jm+RCSPe oOv0sh6qNIM0Z0xL5yxQbzA2hs/KQ+pOaisp0e4pdBn/qB+aWDfQpOM+uPys4TM8jA0WJTQF7Iaf S4/ddEQUQbxJ/k2cQfTPe3VrW3MvHxOkX8bAU0SQ08egZvLLlqNGugbh1zd7TZjP5Vnc8g+J0wYR Ppvpz+ouNM7mwcpFMNYXQ5PawymlsRjKfHWsS7hB/eUUerETf0I8rVq0isF2jKKiFbhw5tw0mJYa f1j+Lwkw0Ur3TpchSlQ=</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</pedidoNFSePNG>

1 answer

0

The structure of your XML is:

<?xml version="1.0" encoding="UTF-8"?>
<pedidoNFSePNG versao="1.0">
    <CNPJ> . . . </<CNPJ>
    <chvAcessoNFS-> . . . </chvAcessoNFS>
    <Signature> . . . </<Signature>
</pedidoNFSePNG>

The documentation shows as example of XML the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<pedidoNFSePNG versao="1.0">
    <CNPJ> . . . </<CNPJ>
    <chvAcessoNFS-> . . . </chvAcessoNFS>
</pedidoNFSePNG>
<Signature> . .  </<Signature>

namely, the Signature should not come within the pedidoNFSePNG and yes after this. I do not know if that is the mistake, because it does not seem to be a mistake of "Prolog"... Another possible problem may be related to the actual contents of the file, which is being uploaded, type encoding or similar.

Browser other questions tagged

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