Page 1 of 1

TIPClientHttp() - ERROR

Posted: Tue Oct 14, 2025 7:48 pm
by Verhoven
Buenas tardes a todos,
Tengo un problema con el siguiente código que no soy capaz de resolver y dejo aquí por si alguien me puede aportar algo de luz:

Code: Select all | Expand

#require "hbssl"
#require "hbtip"

PROCEDURE pruebahttps()
   LOCAL cPostData, cResponse
   LOCAL cUrl := "https://api.juanillo.es/json/api/transaction"
   LOCAL oClient := TIPClientHttp():New( cUrl )  // Inicializar el cliente HTTP

   if oClient:Open()
      msginfo(oClient:Open(), "oClient:Open()")
   else
      msginfo(oClient:Open(), "ERROR: oClient:Open()")
      return
   endif

   // Datos a enviar en el cuerpo del POST (por ejemplo, en formato JSON)
   cPostData := '{"clave":"valor", "otro":"dato"}'

   // Configurar la solicitud
   oClient:nConnTimeout := 5000  // Timeout de conexión (5 segundos)
   oClient:lSSL         := .T.   // Habilitar SSL para HTTPS

   // Abrir conexión
   IF oClient:Open()
      // Enviar solicitud POST
      oClient:Post( cPostData, "application/json" )
      cResponse := oClient:cReply

      // Verificar respuesta
      IF !Empty( cResponse )
         msginfo( cResponse, "Respuesta del servidor:")
         msginfo(hb_ValToExp( oHTTP:hHeaders ),"oHTTP:hHeaders")
      ELSE
         msginfo(oClient:LastError(),"Error al enviar la solicitud POST:")
      ENDIF

      // Cerrar conexión
      oClient:Close()
   ELSE
      msginfo(oClient:LastError(),"No se pudo conectar al servidor:")
   ENDIF

RETURN
y el error que se obtiene en ejecución para la línea: LOCAL oClient := TIPClientHttp():New( cUrl ) // Inicializar el cliente HTTP
Application
===========
Path and name: c:\CLIWIN\FW\wintpv_64.exe (64 bits)
Size: 6,524,928 bytes
Compiler version: Harbour 3.2.0dev (r2503251254)
FiveWin version: FWH 25.01
C compiler version: Microsoft Visual C 19.32.31329 (64-bit)
Windows 10 64 Bits, version: 6.2, Build 9200

Time from start: 6 sec
Error occurred at: 14-10-25, 21:42:18
Error description: Error BASE/1081 Operaci¢n no soportada: TIPCLIENTHTTP:new()
Args:
[ 1] = O TIPCLIENTHTTP
[ 2] = C https

Stack Calls
===========
Called from: hbtip\client.prg => TIPCLIENT:NEW( 0 )
Called from: hbtip\httpcli.prg => TIPCLIENTHTTP:NEW( 0 )
Called from: wintpv.prg => PRUEBAHTTPS( 7 )

Re: TIPClientHttp() - ERROR

Posted: Tue Oct 14, 2025 9:09 pm
by FiveWiDi
Yo probaría así:

...
LOCAL oClient := Nil

oClient := TIPClientHttp():New( cUrl ) // Inicializar el cliente HTTP

if oClient:Open()
....

Re: TIPClientHttp() - ERROR

Posted: Wed Oct 15, 2025 7:31 am
by Verhoven
Probado, sigue dando el mismo fallo de operación no soportada.

Re: TIPClientHttp() - ERROR

Posted: Sat Oct 18, 2025 8:30 am
by Enrico Maria Giordano
You have to link hbssl.lib, libssl-3.lib and libcrypto-3.lib and put libssl-3.dll and libcrypto-3.dll in your directory (or in the path).