Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erro ao validar NF-e #55

Open
igoroliveira-ax4b opened this issue May 25, 2023 · 1 comment
Open

Erro ao validar NF-e #55

igoroliveira-ax4b opened this issue May 25, 2023 · 1 comment

Comments

@igoroliveira-ax4b
Copy link

Durante a execução da função abaixo, a variável match se mantem com valor None, não sendo possível emitir a NFe.

def analisar_retorno_raw(operacao, raiz, xml, retorno, classe):
    retorno.raise_for_status()
    match = re.search('<soap:Body>(.*?)</soap:Body>',
                      retorno.text.replace('\n', ''))
    if match:
        xml_resposta = match.group(1)
        resultado = etree.tostring(etree.fromstring(xml_resposta)[0])
        classe.Validate_simpletypes_ = False
        resposta = classe.parseString(resultado, silence=True)
        return RetornoSoap(operacao, raiz, xml, retorno, resposta)

O método search utiliza como parâmetro pattern o valor '<soap:Body>(.*?)</soap:Body>'
Porém a variável retorno possui o seguinte conteúdo:

'<?xml version=\'1.0\' encoding=\'UTF-8\'?><S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope"><S:Body><nfeResultMsg xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NFeStatusServico4"><retConsStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="4.00"><tpAmb>2</tpAmb><verAplic>W-3.0.27</verAplic><cStat>107</cStat><xMotivo>Servico em operacao</xMotivo><cUF>31</cUF><dhRecbto>2023-05-25T15:33:45-03:00</dhRecbto><dhRetorno>2023-05-25T15:33:45-03:00</dhRetorno></retConsStatServ></nfeResultMsg></S:Body></S:Envelope>'

Não existe a tag soap:Body porém existe <S:Body>

É algum erro na lib, ou seria algum do lado emissor da NFe?

@crsilveira
Copy link

veja isso : #47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants