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:
y el error que se obtiene en ejecuci贸n para la l铆nea: LOCAL oClient := TIPClientHttp():New( cUrl ) // Inicializar el cliente HTTP
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:
#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
RETURNApplication
===========
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 )