Error 500 while consuming Nfedownloadnf

Asked

Viewed 2,086 times

-2

I’m trying to consume the NFE download service on the farm:

https://www.sefazvirtual.fazenda.gov.br/NfeDownloadNF/NfeDownloadNF.asmx

but I have obtained the following error :

Remote server returned an error: (500) Internal Server Error.

The message I’ve been sending is :

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Header>
        <nfeCabecMsg xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/nfeDownloadNF">
            <cUF>31</cUF>
            <versaoDados>3.10</versaoDados>
        </nfeCabecMsg>
    </soap:Header>
    <soap:Body>
        <nfeDadosMsg xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NfeDownloadNF">
            <downloadNFe xmlns="http://www.portalfiscal.inf.br/nfe" versao="3.10">
                <tpAmb>1</tpAmb>
                <xServ>DOWNLOAD NFE</xServ>
                <CNPJ>[NUMERO DO CNPJ]</CNPJ>
                <chNFe>[CHAVE DA NOTA FISCAL]</chNFe>
            </downloadNFe>
        </nfeDadosMsg>
    </soap:Body>
</soap:Envelope>

I removed all spaces as requested(already consume some other services successfully)

        request.Method = "POST";
        request.ContentType = "text/xml";

The certificate I’m sure is correct too.

Could someone point out the mistake ?

  • Only with this information is complicated. How are you making the request (what technology)? And the SOAP headers, are you generating correctly? Did you set the Content-length? Try to supplement the question with all relevant details, so that someone can help better.

  • Thank you so much for the comment. I’m using. Net C#, I put Content-length yes, as I said in the question, for other services the architecture works. However the 500 error was due to an error in the request URL. But I still get the following error :

  • <retDownloadNFe versao="1.00" xmlns="http://www.portalfiscal.inf.br/nfe"> <tpAmb>1</tpAmb> <verAplic>SVAN_2.1.1</verAplic> <cStat>242</cStat> <xMotivo>Bounce: Non-existent nfeCabecMsg element in SOAP Header</xMotivo> <dhResp>2015-11-03T12:18:06</dhResp> </retDownloadNFe>

1 answer

1

The error happens due to a failure in the URL I was using that is different from the one posted in the question. I managed to solve by paying attention to this detail.

Browser other questions tagged

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