Alain da Silva Posted November 1, 2017 Report Share Posted November 1, 2017 bom dia, achei aqui no fórum acho que referencia ao assunto: fladimir Quando baixa xml do site do governo via webservice (baixa com certificado) Consulta NFe Destinadas vem tb criptografado ai tem q descriptografar. Alguem poderia me dizer como faço para descriptografar esse xml? obrigado <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Body> <nfeDistDFeInteresseResponse xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe"> <nfeDistDFeInteresseResult> <retDistDFeInt xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.01"> <tpAmb>1</tpAmb> <verAplic>1.1.9</verAplic> <cStat>138</cStat> <xMotivo>Documento localizado</xMotivo> <dhResp>2017-11-01T12:49:15-02:00</dhResp> <loteDistDFeInt> <docZip schema="procNFe_v3.10.xsd" NSU="000000000002404">H4sIAAAAAAAEAO1a6ZOiyLb/ ... (muito grande) AA==</docZip> </loteDistDFeInt> </retDistDFeInt> </nfeDistDFeInteresseResult> </nfeDistDFeInteresseResponse> </soap:Body> </soap:Envelope> Quote Link to comment Share on other sites More sharing options...
Alain da Silva Posted November 2, 2017 Author Report Share Posted November 2, 2017 tentei dessa forma. function teste() LOCAL cstring,cbase64 cstring:='H4sIAAAAAAAEAO1a6Z ... /qpk/F9MTruIXyIAAA==' cBase64 := HB_Base64Encode( cString, Len(cString ) ) ? cBase64 ? HB_Base64Decode( cBase64 ) return nil Quote Link to comment Share on other sites More sharing options...
fladimir Posted November 2, 2017 Report Share Posted November 2, 2017 Olá eu faço assim: cXML := hb_base64Decode( cDoc ) cXML := hb_ZUncompress( cXML ) Quote Link to comment Share on other sites More sharing options...
Alain da Silva Posted November 3, 2017 Author Report Share Posted November 3, 2017 Valeu Fladimir, funcionou perfeito. fico assim essa parte. if AT("<cStat>138</cStat>",cdoc)>0 cRetornot:="Download Efetuado com Sucesso" cBase64 := oXmlDoc:findFirst( "docZip" ) cBase64 := cBase64:cdata cBase64 := hb_ZUncompress(HB_base64Decode(cBase64)) SaveFile( DiskName()+":\wfatura\XMLFORNECEDOR\" + cChaveNfe + "-nfe.xml", cBase64) Return cRetornot endif Obrigado Quote Link to comment Share on other sites More sharing options...
fladimir Posted November 3, 2017 Report Share Posted November 3, 2017 Q bom Obrigado por compartilhar Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.