Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Colaboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #11  
Antiguo 02-01-2024
Badillo Badillo is offline
Miembro
 
Registrado: jun 2021
Posts: 45
Poder: 0
Badillo Va por buen camino
Necesito su ayuda con este ejemplo

Estoy tratando de hacer una llamada a este API, para obtener del un JSON y así validar la información. Ajusté la función según lo que entendí del ejempo que debaten acá, pero cuando hace por conectarse emite el siguiente error:

raised exception class EIdOSSLUnderlyingCryptoError with message 'Error connecting with SSL.
error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

El código fuente de la función es:

Código Delphi [-]
function TValidateNPIForAPI.IsValidateNPIForAPI(aNumber, aNpiType, aTaxonomy :string): boolean;
var
  xResponse: TStringStream;
  xUrl, xParams: String;
  xJsonObj: TlkJSONbase;
  xCount: Integer;
  SSLHandler: TIdSSLIOHandlerSocketOpenSSL;
begin
    Result := False;
    xUrl :=  'https://npiregistry.cms.hhs.gov/api/?version=2.1';
    xResponse := TStringStream.Create('');
    xJsonObj :=  TlkJSONbase.Create;

    if aNumber <> '' then
      xParams := xParams + '&number='+HttpEncode(aNumber);

    if aNpiType <> '' then
      xParams := xParams + '&enumeration_type='+HttpEncode(aNpiType);

    if aTaxonomy <> '' then
      xParams := xParams + '&taxonomy_description='+HttpEncode(aTaxonomy);

    try
      SSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
      Fhttp := TIDHttp.Create(nil);
      Fhttp.IOHandler := SSLHandler;
      Fhttp.Request.Clear();
      Fhttp.Request.Accept := '*/*';
      Fhttp.Request.CustomHeaders.Values['X-MANTISAPI-CODE'] := 'eeXahKo8';
      Fhttp.Get(xUrl + xParams, xResponse);
      TlkJSONbase(xJsonObj) := TlkJSON.ParseText(xResponse.DataString);
      xCount := StrToInt(xJsonObj.Field['result_count'].Value);
      Result := (xCount > 0);
    finally
      xResponse.Free;
      xJsonObj.Free;
      Result := False;
    end;
end;

Como ejemplo en los parámetros pueden utilizar aNumber = '1871147520' y aNpiType = 'NPI-1'.

Gracias por su ayuda.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Incluir Headers de SOAP en web services Delphi 2010 Revow Delphi para la web 6 19-05-2015 23:32:59
invocar a una dll lestad Varios 3 07-03-2014 18:47:54
Como modificar los headers de un DBGrid yn4v4s OOP 3 16-07-2012 20:43:07
dbgrid con sub-headers samantha jones Varios 1 02-03-2005 21:30:25
Indicador de orden en los headers de un TListView walrus OOP 1 11-10-2004 19:50:30


La franja horaria es GMT +2. Ahora son las 06:45:54.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi