VIDEO 4071 - Webservice - Windev29 WEBDEV mobile - Uninfe Dll Contributor Registration
https://youtu.be/jPPGAxT4swk
----
PROCEDURE uninfe_consulta_cadastro()
s_auditoria is string = ""
retorno_xml is string = ""
s_recebe_cnpj is string = WebserviceReadHTTPHeader("s_recebe_cnpj") // cnpj do emitente-> certificado
s_recebe_senha is string = WebserviceReadHTTPHeader("s_recebe_senha") // senha certificado
n_recebe_CUF is int = WebserviceReadHTTPHeader("n_recebe_CUF") // 43 - res
s_recebe_cnpj_cadastro is string = WebserviceReadHTTPHeader("s_recebe_cnpj_cadastro")
s_arquivo_certificado is string = fCurrentDir()+"\erpmatos\"+s_recebe_cnpj+".pfx"
s_diretorio is string = fCurrentDir()+"\erpmatos\xml_"+s_recebe_cnpj+"\retorno"
IF fMakeDir(s_diretorio)=False THEN
END
s_diretorio_log is string=fCurrentDir()+"\erpmatos\xml_"+s_recebe_cnpj+"\retorno"
IF fMakeDir(s_diretorio_log)=False THEN
END
s_auditoria+="Versao 27.03.15.31"
s_auditoria+=CR+"s_recebe_cnpj["+s_recebe_cnpj+"]"
//s_auditoria+=CR+"s_recebe_senha["+s_recebe_senha+"]"
s_auditoria+=CR+"n_recebe_CUF["+n_recebe_CUF+"]"
s_auditoria+=CR+"s_recebe_cnpj_cadastro["+s_recebe_cnpj_cadastro+"]"
s_auditoria+=CR+"s_arquivo_certificado["+s_arquivo_certificado+"]"
s_auditoria+=CR+"s_diretorio["+s_diretorio+"]"
s_auditoria+=CR+"s_diretorio_log["+s_diretorio_log+"]"
//Revisar acima
//https://www.youtube.com/live/qUosXijsuPw?si=plDq6F3j8mz9yfgI //comeca 27.32
// configurações minimas
o_configuracao is Unimake.Business.DFe.Servicos.Configuracao
o_configuracao.TipoDFe = TipoDFe.NFe //1 // nfe
o_configuracao.CertificadoArquivo = s_arquivo_certificado
o_configuracao.CertificadoSenha = s_recebe_senha
//criar o xml
oConsCad is Unimake.Business.DFe.XML.NFe.ConsCad()
oConsCad.VERSAO = "2.00"
oInfCons is Unimake.Business.DFe.XML.NFe.InfCons()
oInfCons.CNPJ=s_recebe_cnpj_cadastro
oInfCons.uf=UFBrasil.RS // cuf=43 direto //perguntar
oConsCad.InfCons=oInfCons
WHEN EXCEPTION IN
// vamos consumir o servico // Criado um objeto oconsultacadastro
oConsultaCadastro is Unimake.Business.DFe.Servicos.NFe.ConsultaCadastro()
// vamos chamar ele, passando o xml e a configuração
oConsultaCadastro.Executar(oConsCad,o_configuracao)
oRetConsCad is Unimake.Business.DFe.XML.NFe.RetConsCad <- oConsultaCadastro.Result
cstat is string=oRetConsCad.InfCons.CStat
xmotivo is string=oRetConsCad.InfCons.XMotivo
razao_social is string=oRetConsCad.InfCons.InfCad.XNome
retorno_xml = oConsultaCadastro.RetornoWSString
DO
retorno_xml="ERRO:"+ExceptionInfo(errFullDetails)
END
// vamos gravar auditoria no servidor
s_auditoria+=CR+retorno_xml+CR
fSaveText(s_diretorio_log+"\cadastro_log.txt",s_auditoria)
fSaveText(s_diretorio+"\cadastro_retorno.xml",retorno_xml)
RESULT retorno_xml