macs Posted October 27, 2022 Report Share Posted October 27, 2022 Pessoal, alguém já passou por isso? Começou a acontecer do nada no cliente. O certificado está dentro da validade. Quote Link to comment Share on other sites More sharing options...
coutinho.amauri Posted October 27, 2022 Report Share Posted October 27, 2022 verifique se o sistema operacional do cliente recebeu alguma atualização Quote Link to comment Share on other sites More sharing options...
macs Posted October 27, 2022 Author Report Share Posted October 27, 2022 Não sei te informar. Mas configurei meu notebook pra poder tentar enviar, e está ocorrendo a mesma coisa. O cliente não tem nenhuma restrição, já foi checado pelo suporte da empresa responsável. Não sei o que fazer... são mais de 300 notas que o cliente terá que enviar, 1 a 1 pelo portal da prefeitura, caso não consiga descobrir o problema. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted October 27, 2022 Report Share Posted October 27, 2022 Verifique os novos schemas na NFSe . Quote Link to comment Share on other sites More sharing options...
macs Posted October 28, 2022 Author Report Share Posted October 28, 2022 Alguém tem alguma rotina que faça a transmissão de nota fiscal de serviço via webservice de qualquer prefeitura? Já ajudaria bastante. Obrigado. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted October 28, 2022 Report Share Posted October 28, 2022 Macs, você já ligou aqui para ver o que mudou? https://joaopessoa.pb.gov.br/pc/solucaoWsNfse.xhtml Regards, saludos. Quote Link to comment Share on other sites More sharing options...
macs Posted October 31, 2022 Author Report Share Posted October 31, 2022 Não mudou em nada. De repente a rotina parou de funcionar. Já enviei o xml pra eles, está correto. Eles falaram que o webservices está operando normalmente. cSOAPAction := ::getUrlNFSe( _RECEPCIONARLOTERPS ) TRY oServerWS := CreateObject( 'MSXML2.ServerXMLHTTP.6.0' ) oServerWS:setOption( 3, 'CURRENT_USER\MY\'+cCN ) oServerWS:Open('POST', ::linkWS, .t.) oServerWS:setRequestHeader('SOAPAction', cSOAPAction ) oServerWS:setRequestHeader('Content-Type','application/soap+xml; charset=utf-8') // Para NFSe CATCH ::oCertificado:end() RETURN msgErro('Não foi possível iniciar a conexão com o webservice!','Recepcionando') END IF oServerWS == nil ::oCertificado:end() RETURN msgErro('Não foi possível iniciar o objeto de conexão do webservice','Recepcionando') ENDIF TRY oServerWS:Send( oDOMDoc:xml ) <<<< ----- Aqui que ocorre o erro CATCH e cMsgErro := 'Falha: Não foi possível estabelecer conexão com o serviço!'+CRLF+; 'Error: ' +Transform(e:GenCode,nil) +CRLF+; 'SubC: ' +Transform(e:SubCode,nil) +CRLF+; 'OSCode: ' +Transform(e:OsCode,nil) +CRLF+; 'SubSystem: '+Transform(e:SubSystem,nil) +CRLF+; 'Mensangem: '+e:Description ::oCertificado:end() RETURN msgErro(cMsgErro,"Recepcionando") END Quote Link to comment Share on other sites More sharing options...
kapiaba Posted October 31, 2022 Report Share Posted October 31, 2022 Tente adaptar para este modelo: // C:\FWH..\SAMPLES\LAURENT.PRG - 17/10/2022 - kapiabafwh@gmail.com #Include "FiveWin.ch" FUNCTION Main() LOCAL oServerWS, cUrl, aArray, x1, erro, oADODBStream, cRetorno cUrl := "http://www.fivewin.com.br" #ifdef __XHARBOUR__ // PERFEITO COM XHARBOUR( I Like ) Try Try oServerWS := CreateObject( 'MSXML2.XMLHTTP' ) Catch oServerWS := CreateObject( 'Microsoft.XMLHTTP' ) End Catch MsgInfo( 'Erro na Criação do Serviço' ) RETURN NIL End #else // PERFEITO COM HARBOUR. ( no Like. kkkkk ) Try Try oServerWS := win_OleCreateObject( 'MSXML2.XMLHTTP' ) Catch oServerWS := win_OleCreateObject( 'Microsoft.XMLHTTP' ) End Catch MsgInfo( 'Erro na Criação do Serviço! Com Harbour', 'Atenção!' ) RETURN NIL End #endif oServerWS:Open( 'GET', cUrl, .F. ) oServerWS:setRequestHeader( "Content-Type", "text/xml; charset=utf-8" ) oServerWS:Send() IF oServerWS:STATUS != 200 MsgStop( AllTrim( Str( oServerWS:Status ) ) + " - " + oServerWS:StatusText, "Erro" ) RETURN NIL ENDIF WHILE oServerWS:ReadyState != 4 SYSREFRESH() oServerWS:WaitForResponse( 1000 ) END cRetorno := oServerWS:ResponseBody() // ? cRetorno IF FILE( "LAUREN.txt" ) ERASE LAUREN.txt ENDIF MemoWrit('LAUREN.txt', cRetorno) RETURN NIL // FIN / END Regards, saludos. Quote Link to comment Share on other sites More sharing options...
macs Posted October 31, 2022 Author Report Share Posted October 31, 2022 Erro MSXML2.ServerXMLHTTP.5.0/3 - Fim de Tempo para Bloqueio: WAITFORRESPONSE Quote Link to comment Share on other sites More sharing options...
kapiaba Posted October 31, 2022 Report Share Posted October 31, 2022 56 minutos atrás, macs disse: Erro MSXML2.ServerXMLHTTP.5.0/3 - Fim de Tempo para Bloqueio: WAITFORRESPONSE Poste o código para críticas. Não é para fazer igual, é só a parte de acionar o SITE. Regards, saludos. Quote Link to comment Share on other sites More sharing options...
macs Posted October 31, 2022 Author Report Share Posted October 31, 2022 O código continua o mesmo: TRY oServerWS := CreateObject( 'MSXML2.ServerXMLHTTP.5.0' ) // MSXML2.XMLHTTP oServerWS:setOption( 3, 'CURRENT_USER\MY\'+cCN ) oServerWS:Open('POST', ::linkWS, .t.) oServerWS:setRequestHeader('SOAPAction', cSOAPAction ) oServerWS:setRequestHeader('Content-Type','application/soap+xml; charset=utf-8') // Para NFSe CATCH ::oCertificado:end() RETURN msgErro('Não foi possível iniciar a conexão com o webservice!','Recepcionando') END IF oServerWS == nil ::oCertificado:end() RETURN msgErro('Não foi possível iniciar o objeto de conexão do webservice','Recepcionando') ENDIF TRY oServerWS:Send( oDOMDoc:xml ) CATCH e cMsgErro := 'Falha: Não foi possível estabelecer conexão com o serviço!'+CRLF+; 'Error: ' +Transform(e:GenCode,nil) +CRLF+; 'SubC: ' +Transform(e:SubCode,nil) +CRLF+; 'OSCode: ' +Transform(e:OsCode,nil) +CRLF+; 'SubSystem: '+Transform(e:SubSystem,nil) +CRLF+; 'Mensangem: '+e:Description ::oCertificado:end() RETURN msgErro(cMsgErro,"Recepcionando") END WHILE oServerWS:readyState <> 4 #IfnDef DEBUG_MODE SysRefresh() #Endif oServerWS:WaitForResponse( 1000 ) /////// ERRO AQUI //////// ENDDO ::cRespostaWS := STRTRAN(oServerWS:responseText,'<','<') ::cRespostaWS := STRTRAN(::cRespostaWS,'>','>') ::cRespostaWS := STRTRAN(::cRespostaWS,'"','"') Quote Link to comment Share on other sites More sharing options...
kapiaba Posted October 31, 2022 Report Share Posted October 31, 2022 veja se ajuda: http://www.pctoledo.com.br/forum/viewtopic.php?f=4&t=23628 Regards, saludos. Quote Link to comment Share on other sites More sharing options...
macs Posted October 31, 2022 Author Report Share Posted October 31, 2022 Infelizmente, nada! Quote Link to comment Share on other sites More sharing options...
kapiaba Posted November 1, 2022 Report Share Posted November 1, 2022 Macs, tente agora: // C:\FWH..\SAMPLES\MACS.PRG by kapiabafwh@gmail.com // Isto esta correto mesmo? cSOAPAction := ::getUrlNFSe( _RECEPCIONARLOTERPS ) TRY // oServerWS := CreateObject( 'MSXML2.ServerXMLHTTP.6.0' ) #ifdef __XHARBOUR__ // PERFEITO COM XHARBOUR( I Like ) Try Try oServerWS := CreateObject( 'MSXML2.XMLHTTP' ) Catch oServerWS := CreateObject( 'Microsoft.XMLHTTP' ) End Catch MsgInfo( 'Erro na Criação do Serviço' ) RETURN NIL End #else // PERFEITO COM HARBOUR. ( no Like. kkkkk ) Try Try oServerWS := win_OleCreateObject( 'MSXML2.XMLHTTP' ) Catch oServerWS := win_OleCreateObject( 'Microsoft.XMLHTTP' ) End Catch MsgInfo( 'Erro na Criação do Serviço! Com Harbour', 'Atenção!' ) RETURN NIL End #endif // esta area esta correta mesmo? oServerWS:setOption( 3, 'CURRENT_USER\MY\'+cCN ) // isto esta correto? oServerWS:Open('POST', ::linkWS, .t.) oServerWS:setRequestHeader('SOAPAction', cSOAPAction ) oServerWS:setRequestHeader('Content-Type','application/soap+xml; charset=utf-8') // Para NFSe CATCH RETURN msgErro('Não foi possível iniciar a conexão com o webservice!','Recepcionando') ::oCertificado:end() END IF oServerWS == nil RETURN msgErro('Não foi possível iniciar o objeto de conexão do webservice','Recepcionando') ::oCertificado:end() ENDIF TRY oServerWS:Send( oDOMDoc:xml ) // <<<< ----- Aqui que ocorre o erro CATCH e cMsgErro := 'Falha: Não foi possível estabelecer conexão com o serviço!'+CRLF+; 'Error: ' +Transform(e:GenCode,nil) +CRLF+; 'SubC: ' +Transform(e:SubCode,nil) +CRLF+; 'OSCode: ' +Transform(e:OsCode,nil) +CRLF+; 'SubSystem: '+Transform(e:SubSystem,nil) +CRLF+; 'Mensangem: '+e:Description ::oCertificado:end() RETURN msgErro(cMsgErro,"Recepcionando") END Regards, saludos. Quote Link to comment Share on other sites More sharing options...
macs Posted November 1, 2022 Author Report Share Posted November 1, 2022 Kapi, ainda nada! Vou tentar mudar a versão do FWH e xHarbour e tentar novamente. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted November 1, 2022 Report Share Posted November 1, 2022 Essa pohha não vai me vencer! kkkkkkkkkkkkkkkkkkkkkkkkkkk Macs, teste este exemplo para ver o que ocorre: TRY #ifdef __XHARBOUR__ // xHarbour Try oServerWS := CreateObject( "MSXML2.ServerXMLHTTP.6.0" ) oServerWS:SetTimeouts(40000,40000,40000,40000) Catch MsgInfo( 'Erro na Criação do Serviço' ) RETURN NIL End #else Try oServerWS := win_OleCreateObject( "MSXML2.ServerXMLHTTP.5.0" ) oServerWS:SetTimeouts(40000,40000,40000,40000) Catch MsgInfo( 'Erro na Criação do Serviço!', 'Atenção!' ) RETURN NIL End #endif // Macs, onde voce viu esse exemplo? oServerWS:setOption( 3, 'CURRENT_USER\MY\'+cCN ) // ??? NUNCA VI IGUAL. // oServerWS:Open( "POST", cUrl, .F. ) // oServerWS:Open('POST', ::linkWS, .t.) // .T. ?? SERA? oServerWS:Open( 'POST', ::linkWS, .F. ) // MODIFIQUEI Joao // ISTO ESTA CORRETO? UTF 8? oServerWS:setRequestHeader('SOAPAction', cSOAPAction ) oServerWS:setRequestHeader('Content-Type','application/soap+xml; charset=utf-8') // Para NFSe /* oServerWS:SetRequestHeader( "Content-Type", "application/x-www-form-urlencoded" ) oServerWS:SetRequestHeader( "Connection", "keep-alive" ) */ CATCH RETURN msgErro('Não foi possível iniciar a conexão com o webservice!','Recepcionando') ::oCertificado:end() END IF oServerWS == nil RETURN msgErro('Não foi possível iniciar o objeto de conexão do webservice','Recepcionando') ::oCertificado:end() ENDIF TRY oServerWS:Send( oDOMDoc:xml ) // QUEM E oDOMDoc Macs? oServerWS:WaitForResponse( 10000 ) // MODIFIQUEI Joao /* // OU: oServerWS:Send() oServerWS:WaitForResponse( 500000 ) */ CATCH e cMsgErro := 'Falha: Não foi possível estabelecer conexão com o serviço!'+CRLF+; 'Error: ' +Transform(e:GenCode,nil) +CRLF+; 'SubC: ' +Transform(e:SubCode,nil) +CRLF+; 'OSCode: ' +Transform(e:OsCode,nil) +CRLF+; 'SubSystem: '+Transform(e:SubSystem,nil) +CRLF+; 'Mensangem: '+e:Description ::oCertificado:end() RETURN msgErro(cMsgErro,"Recepcionando") END /* DESLIGUEI - Joao WHILE oServerWS:readyState <> 4 #IfnDef DEBUG_MODE SysRefresh() #Endif // PASSEI PARA O SEND() QUE E O CORRETO. oServerWS:WaitForResponse( 1000 ) /////// ERRO AQUI //////// ENDDO */ ::cRespostaWS := STRTRAN(oServerWS:responseText,'<','<') ::cRespostaWS := STRTRAN(::cRespostaWS,'>','>') ::cRespostaWS := STRTRAN(::cRespostaWS,'"','"') Regards, saludos. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted November 1, 2022 Report Share Posted November 1, 2022 Macs, teste este modelo e veja se funciona na sua máquina. Aqui vai de boas. #include "FiveWin.ch" FUNCTION Main() LOCAL cOnde, cCnpj, cNome, cEndereco, cNro, cComplemento, cBairro, cCidade, ; cEstado, cCep, cTelefone cOnde := SPACE(10) cCnpj := "48209381000140" // TEST ONLY cNome := SPACE(50) cEndereco := SPACE(40) cNro := SPACE(10) cComplemento := SPACE(10) cBairro := SPACE(20) cCidade := SPACE(30) cEstado := SPACE(02) cCep := SPACE(08) cTelefone := SPACE(17) GetCNPJ( cOnde, cCnpj, cNome, cEndereco, cNro, cComplemento, cBairro, cCidade, cEstado, cCep, cTelefone ) RETURN NIL FUNCTION GetCNPJ( cOnde, cCnpj, cNome, cEndereco, cNro, cComplemento, cBairro, cCidade, cEstado, cCep, cTelefone ) LOCAL oServerWS, cUrl, aArray, x1, erro, oADODBStream IF Len( AllTrim( cCnpj ) ) < 14 MsgInfo( "Somente Pessoa Juridica para consultar os dados na Receita !!!", "Atenção " ) RETURN( .T. ) ENDIF cUrl := "https://www.receitaws.com.br/v1/cnpj/" + cCnpj // cUrl:= "https://publica.cnpj.ws/cnpj/" + cCnpj #ifdef __XHARBOUR__ // PERFEITO COM XHARBOUR( I Like ) Try Try oServerWS := CreateObject( 'MSXML2.XMLHTTP' ) Catch oServerWS := CreateObject( 'Microsoft.XMLHTTP' ) End Catch MsgInfo( 'Erro na Criação do Serviço' ) RETURN NIL End #else // PERFEITO COM HARBOUR. ( no Like. kkkkk ) Try Try oServerWS := win_OleCreateObject( 'MSXML2.XMLHTTP' ) Catch oServerWS := win_OleCreateObject( 'Microsoft.XMLHTTP' ) End Catch MsgInfo( 'Erro na Criação do Serviço! Com Harbour', 'Atenção!' ) RETURN NIL End #endif oServerWS:Open( 'GET', cUrl, .F. ) oServerWS:setRequestHeader( "Content-Type", "text/xml; charset=utf-8" ) oServerWS:Send() IF oServerWS:STATUS != 200 MsgStop( AllTrim( Str( oServerWS:Status ) ) + " - " + oServerWS:StatusText, "Erro" ) RETURN NIL ENDIF WHILE oServerWS:readyState != 4 SYSREFRESH() oServerWS:WaitForResponse( 1000 ) END x1 := hb_jsonDecode( oServerWS:responseText, @aArray ) IF aArray == nil MsgStop( "Erro ao retornar os dados. Tente novamente." ) RETURN NIL ENDIF IF aArray[ 'status' ] != 'OK' MsgStop( aArray[ 'message' ], "Erro" ) RETURN NIL ENDIF MsgInfo( "NOME: " + AllTrim( aArray[ 'nome' ] ) + CRLF + ; "FANTASIA: " + AllTrim( aArray[ 'fantasia' ] ) + CRLF + ; "ENDEREÇO: " + AllTrim( aArray[ 'logradouro' ] ) + ", " + AllTrim( aArray[ 'numero' ] ) + " " + AllTrim( aArray[ 'complemento' ] ) + CRLF + ; "BAIRRO: " + AllTrim( aArray[ 'bairro' ] ) + " CEP: " + AllTrim( aArray[ 'cep' ] ) + CRLF + ; "CIDADE: " + AllTrim( aArray[ 'municipio' ] ) + "-" + AllTrim( aArray[ 'uf' ] ) + CRLF + ; "TELEFONE: " + AllTrim( aArray[ 'telefone' ] ) + CRLF + CRLF + ; "NATUREZA JURÍDICA: " + AllTrim( aArray[ 'natureza_juridica' ] ) + CRLF + ; "TIPO: " + AllTrim( aArray[ 'tipo' ] ) + CRLF + ; "SITUAÇÃO: " + AllTrim( aArray[ 'situacao' ] ) + CRLF + ; "DATA SITUAÇÃO: " + AllTrim( aArray[ 'data_situacao' ] ) + CRLF + ; "ULTIMA ATUALIZAÇÃO: " + AllTrim( aArray[ 'ultima_atualizacao' ] ), "CNPJ CONSULTA" ) cNome = AllTrim( aArray[ 'nome' ] ) cEndereco = AllTrim( aArray[ 'logradouro' ] ) cNro = AllTrim( aArray[ 'numero' ] ) cNro = StrTran( cNro, ".", "", 1, 10 ) cNro = Val( cNro ) cComplemento = AllTrim( aArray[ 'complemento' ] ) cBairro = AllTrim( aArray[ 'bairro' ] ) cCep = AllTrim( aArray[ 'cep' ] ) cCidade = AllTrim( aArray[ 'municipio' ] ) cEstado = AllTrim( aArray[ 'uf' ] ) cTelefone = AllTrim( aArray[ 'telefone' ] ) IF cOnde = "T" cEndereco = cEndereco + " " + AllTrim( Str( cNro, 10 ) ) + " " + AllTrim( cComplemento ) ENDIF cNome = cNome + spac( 100 - Len( cNome ) ) cEndereco = cEndereco + spac( 100 - Len( cEndereco ) ) cComplemento = cComplemento + spac( 100 - Len( cComplemento ) ) cBairro = cBairro + spac( 100 - Len( cBairro ) ) cCep = cCep + spac( 10 - Len( cCep ) ) cCep := StrTran( cCep, ".", "", 1, 10 ) cCidade = cCidade + spac( 50 - Len( cCidade ) ) cTelefone = cTelefone + spac( 20 - Len( cTelefone ) ) RETURN NIL Regards, saludos. Quote Link to comment Share on other sites More sharing options...
macs Posted November 3, 2022 Author Report Share Posted November 3, 2022 Kapi... estas rotinas para Consulta de CNPJ, CEP, etc. aqui funciona. Mas para envio de Notas Fiscais de Serviço, via webservices, não funciona. O pior é o erro que não diz nada com nada. Fico de mãos atadas sem saber o que fazer ou o que estou fazendo de errado. Ou até mesmo pra dizer que o problema está no cliente, pois no meu ambiente ocorre a mesma coisa. Será que aqui neste fórum não tem ninguém que envia Notas de Serviço via webservices? Quote Link to comment Share on other sites More sharing options...
kapiaba Posted November 3, 2022 Report Share Posted November 3, 2022 Veja se ajuda: http://www.pctoledo.com.br/forum/viewtopic.php?f=43&t=11682&p=66798&hilit=Notas+Fiscais+de+Serviço+Servico#p66798 http://www.pctoledo.com.br/forum/viewtopic.php?f=1&t=12275&p=70615&hilit=Notas+Fiscais+de+Serviço+Servico#p70615 Você testou todos os modelos que postei? De onde você conseguiu este modelo que usas? Regards, saludos. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted November 3, 2022 Report Share Posted November 3, 2022 Seu modelo tem alguma coisa a ver com isso? Eu faço perguntas dentro dos modelos que posto e você não responde. Assim, fica difícil. Ou esse aqui? http://www.pctoledo.com.br/forum/viewtopic.php?f=43&t=18293 Regards, saludos. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted November 3, 2022 Report Share Posted November 3, 2022 Guarde, ou crie uma ROTINA DE ERROS da NFS-E. https://www.pmpf.rs.gov.br/nfse/wp-content/uploads/sites/63/2022/01/erros_comuns_nfse_web_service.pdf Tem como checar/validar se os schemas do .XML estão corretos? Regards, saludos. Quote Link to comment Share on other sites More sharing options...
macs Posted November 3, 2022 Author Report Share Posted November 3, 2022 Pow kapi, seria muito bom se retornasse estes códigos de erros relacionados no documento. Mas como informei, o código de erro não diz nada com nada. 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.