Ir para conteúdo
  • Cadastre-se

EduXml

Membros
  • Total de ítens

    17
  • Registro em

  • Última visita

Últimos Visitantes

O bloco dos últimos visitantes está desativado e não está sendo visualizado por outros usuários.

EduXml's Achievements

Apprentice

Apprentice (3/14)

  • Dedicated Rare
  • Collaborator Rare
  • First Post
  • Week One Done
  • One Month Later

Recent Badges

2

Reputação

3

Community Answers

  1. A solução para a consulta do status do serviço para NFCe foi trocando o certificado para um A1. O outro certificado era um A1 na nuvem para NFe a consulta do status do serviço funciona.
  2. Agora acertei o ncm mas continua o erro, testei no validador do RS 35230656046576000144650010000000011431293461-nfe.xml
  3. Desde já agradeço. Emissor não habilitado para NFC-e estranho ontem entrei no https://www.nfce.fazenda.sp.gov.br/NFCeSiteContribuinte/Secure/CredenciamentoVoluntario.aspx e fiz o credenciamento. A empresa pode se cadastrar como emissor de Nfe e Nfce ?
  4. 35230656046576000144650010000000011749146431-nfe.xml Sim anexo mas apresenta erro
  5. Boa Tarde Estou tentando emitir uma Nfce em homologação pelo AcbrNfe_Exemplo mas apresenta erro tanto na consulta status como envio, o certificado que estou usando é o que fica em nuvem, para Nfe funciona perfeitamente. Segue abaixo telas dos erros.
  6. Resolvido através do HTTP Segue código abaixo function ObterToken():integer; var HTTPClient: TIdHTTP; SSLIOHandler: TIdSSLIOHandlerSocketOpenSSL; url,json: string; JsonStreamRetorno, JsonStreamEnvio: TStringStream; retorno : integer; begin url := 'https://mtls-mp.hml.flagship.maas.link/auth/realms/Matera/protocol/openid-connect/token'; HTTPClient := TIdHTTP.Create(nil); HTTPClient.Request.CharSet := 'utf-8'; HTTPClient.Request.Accept := '*/*'; HTTPClient.Request.AcceptEncoding := 'gzip, deflate, br'; HTTPClient.Request.CustomHeaders.Values['Content-Type'] := 'application/x-www-form-urlencoded'; HTTPClient.HTTPOptions := [hoKeepOrigProtocol, hoInProcessAuth]; HTTPClient.HandleRedirects := True; json:= 'grant_type=client_credentials&client_id=teste&client_secret=123456789'; //aqui era o maior problema JsonStreamEnvio := TStringStream.Create(utf8Encode(json)); JsonStreamRetorno := TStringStream.Create(''); SSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil); try SSLIOHandler.SSLOptions.Mode := sslmUnassigned; SSLIOHandler.SSLOptions.CertFile := 'd:\matera\novo\certificate.pem'; SSLIOHandler.SSLOptions.KeyFile := 'd:\matera\novo\certificate.key'; SSLIOHandler.SSLOptions.SSLVersions := [sslvTLSv1,sslvTLSv1_1,sslvTLSv1_2]; HTTPClient.IOHandler := SSLIOHandler; try HTTPClient.Post(url, JsonStreamEnvio, JsonStreamRetorno); except retorno := HTTPClient.ResponseCode; end; retorno := HTTPClient.ResponseCode; if retorno = 200 then begin JsonStreamRetorno.SaveToFile('d:\token.json'); end; finally HTTPClient.Free; SSLIOHandler.Free; end; end; Obrigado Pessoal.
  7. Resolvido Segue código abaixo function ObterToken():integer; var HTTPClient: TIdHTTP; SSLIOHandler: TIdSSLIOHandlerSocketOpenSSL; url,json: string; JsonStreamRetorno, JsonStreamEnvio: TStringStream; retorno : integer; begin url := 'https://mtls-mp.hml.flagship.maas.link/auth/realms/Matera/protocol/openid-connect/token'; HTTPClient := TIdHTTP.Create(nil); HTTPClient.Request.CharSet := 'utf-8'; HTTPClient.Request.Accept := '*/*'; HTTPClient.Request.AcceptEncoding := 'gzip, deflate, br'; HTTPClient.Request.CustomHeaders.Values['Content-Type'] := 'application/x-www-form-urlencoded'; HTTPClient.HTTPOptions := [hoKeepOrigProtocol, hoInProcessAuth]; HTTPClient.HandleRedirects := True; json:= 'grant_type=client_credentials&client_id=teste&client_secret=123456789'; //aqui era o maior problema JsonStreamEnvio := TStringStream.Create(utf8Encode(json)); JsonStreamRetorno := TStringStream.Create(''); SSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil); try SSLIOHandler.SSLOptions.Mode := sslmUnassigned; SSLIOHandler.SSLOptions.CertFile := 'd:\matera\novo\certificate.pem'; SSLIOHandler.SSLOptions.KeyFile := 'd:\matera\novo\certificate.key'; SSLIOHandler.SSLOptions.SSLVersions := [sslvTLSv1,sslvTLSv1_1,sslvTLSv1_2]; HTTPClient.IOHandler := SSLIOHandler; try HTTPClient.Post(url, JsonStreamEnvio, JsonStreamRetorno); except retorno := HTTPClient.ResponseCode; end; retorno := HTTPClient.ResponseCode; if retorno = 200 then begin JsonStreamRetorno.SaveToFile('d:\token.json'); end; finally HTTPClient.Free; SSLIOHandler.Free; end; end; Obrigado Pessoal.
  8. Olá pessoal Executo no Rest Debugger um post para geração de um token na Api ele pede a confirmação do certificado e funciona, porém quando passo os componentes para o Form não funciona(procedimento efetuado através do Copy Components). Quando ResTRequest1.execute não aparece a tela pedindo o certificado e apresenta erro. Desde já agradeço. Segue abaixo as telas :
  9. Opa segue o link completo da Api Desde já agradeço http://doc-api.matera.com/mp_server.html
  10. Opa segue p link da api no Postman https://ipflagship.freshdesk.com/support/solutions/articles/67000719185
  11. Olá Pessoal Estou tentando obter token de uma Api mas não obtive resultado , já tentei via Http e via Synapse Segue os códigos abaixo , desde já agradeço. ///// via synapse sempre apresenta Bad Request var HTTPSend:THTTPSend; data : string; lParamList := TStringList; begin url := 'https://mtls-mp.hml.flagship.maas.link/auth/realms/Matera/protocol/openid-connect/token'; HTTPSend:= THTTPSend.Create; lParamList := TStringList.Create; lParamList.Add('grant_type=client_credentials'); lParamList.Add('client_id=teste); lParamList.Add('client_secret=123456789'); Data := UTF8Encode(lParamList.Text); HTTPSend.Document.Write(Pointer(Data)^, Length(Data)); try HTTPSend.Protocol:='1.2'; HTTPSend.KeepAlive:=True; HTTPSend.MimeType := 'application/x-www-form-urlencoded'; with HTTPSend.Sock.SSL do begin SSLType:=LT_all; CertificateFile:='d:\cert.pem'; PrivateKeyFile:='d:\cert.key'; CertCAFile:='d:\cert.pem'; end; if HTTPSend.HTTPMethod('Post',url) then begin ShowMessage(HTTPSend.ResultString); end else begin ShowMessage('error'); end; ShowMessage(IntToStr(HTTPSend.Sock.LastError)+' - '+HTTPSend.Sock.LastErrorDesc); finally HTTPSend.Free; end; ///////////////////////////////////////////////////////// //////////////////////////////////////////////////////// via HTTP sempre apresenta erro 400 var HTTP : TidHTTP; SSL: TIdSSLIOHandlerSocketOpenSSL; JsonStreamRetorno : TStringStream; Params: TMemoryStream; begin http := TIdHTTP.Create(Nil); http.Request.ContentType := 'application/x-www-form-urlencoded'; http.Request.Charset := 'UTF-8'; SSL := TIdSSLIOHandlerSocketOpenSSL.Create(HTTP); SSL.SSLOptions.Create; SSL.SSLOptions.CertFile := 'd:\cert.pem'; SSL.SSLOptions.KeyFile := 'd:\cert.key'; SSL.SSLOptions.RootCertFile := 'd:\cert.pem'; SSL.SSLOptions.Mode := sslmUnassigned; SSL.SSLOptions.VerifyMode := []; SSL.SSLOptions.VerifyDepth := 0; SSL.sslOptions.SSLVersions := [sslvTLSv1,sslvTLSv1_1,sslvTLSv1_2]; HTTP.IOHandler := SSL; JsonStreamRetorno := TStringStream.Create(''); Params:= TMemoryStream.Create; WriteStringToStream(Params, 'grant_type,client_credentials',IndyTextEncoding_UTF8); WriteStringToStream(Params, 'client_id,teste',IndyTextEncoding_UTF8); WriteStringToStream(Params, 'client_secret,12345678',IndyTextEncoding_UTF8); Params.Position := 0; try http.Post(url, Params, JsonStreamRetorno); except retorno := http.ResponseCode; end; retorno := http.ResponseCode; if retorno = 200 then begin end;
  12. Boa Tarde . Tenho este código abaixo para conexão Rest para gerar um token , porém necessito através do Rest enviar o certificado na requisição, não achei nenhum exemplo. No Rest Debugger funciona ele pede o certificado. Segue abaixo o código: Desde já agradeço. function teste(): WideString; var restClient: TRESTClient; restRequest: TRESTRequest; restResponse: TRESTResponse; begin restClient := TRESTClient.Create(''); restRequest := TRESTRequest.Create(restClient); restResponse := TRESTResponse.Create(restClient); try try restClient.Accept := 'application/json, text/plain; q=0.9, text/html;q=0.8,'; restClient.AcceptCharset := 'UTF-8, *;q=0.8'; restClient.AutoCreateParams := true; restClient.AllowCookies := True; restClient.BaseURL := 'https://mtls-mp.hml.flagship.maas.link/auth/realms/Matera/protocol/openid-connect/token'; restClient.ContentType := 'application/x-www-form-urlencoded'; restClient.FallbackCharsetEncoding := 'UTF-8'; restClient.HandleRedirects := True; restResponse.ContentType := 'text/xml'; restRequest.Accept := 'application/json, text/plain; q=0.9, text/html;q=0.8,'; restRequest.AcceptCharset := 'UTF-8, *;q=0.8'; restRequest.AcceptEncoding := ''; restRequest.Client := restClient; restRequest.Method := rmPOST; restRequest.SynchronizedEvents := False; restRequest.Response := restResponse; restRequest.Params.Add; RESTRequest.Params.Items[0].name := 'grant_type'; RESTRequest.Params.Items[0].Value := 'client_credentials'; restRequest.Params[0].Kind := pkGETorPOST; restRequest.Params[0].ContentType := ctNone; restRequest.Params.Add; RESTRequest.Params.Items[1].name := 'client_id'; RESTRequest.Params.Items[1].Value := 'teste-hml'; restRequest.Params[1].Kind := pkGETorPOST; restRequest.Params[1].ContentType := ctNone; restRequest.Params.Add; RESTRequest.Params.Items[2].name := 'client_secret'; RESTRequest.Params.Items[2].Value := '12345678'; restRequest.Params[2].Kind := pkGETorPOST; restRequest.Params[2].ContentType := ctNone; restRequest.Execute; result := restResponse.Content; except on e: Exception do begin result := 'Erro: ' + e.Message + ' XML: ' + restResponse.Content; end end; finally restClient.Free; end; end;
  13. Boa Tarde Diego Também estou querendo . Li o os links enviados pelo EMBarbosa mas a coisa é complexa, e o pior será que vai funcionar..
  14. Boa tarde EMBarbosa Agradeço, vou ler o artigo
×
×
  • Criar Novo...

Informação Importante

Colocamos cookies em seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies, caso contrário, assumiremos que você está bem para continuar.