Files
MBS/MOVIL401/MBSinventario/conexion_demo.4gl
T

37 lines
1.0 KiB
Plaintext

IMPORT util
TYPE t_sync_cmd RECORD
oper STRING,
data STRING
END RECORD
FUNCTION conexion_demo()
DEFINE purl,cmd,res, msg STRING,
ret INT
DEFINE r_cmd t_sync_cmd
LET purl="http://200.88.67.188:8098"
# LET purl="http://192.168.1.119:8097"
LET r_cmd.oper = "get_status"
LET r_cmd.data = util.JSON.stringify(' ') -- aca se convierte a string los datos de la operacion
LET cmd = util.JSON.stringify(r_cmd) -- aca se convierte a string el comando/operacion a enviar al server
CALL sync_send_command(purl, cmd) RETURNING ret, res
IF ret ==0 THEN
RETURN purl
ELSE
LET purl="http://192.168.40.2:8098"
CALL sync_send_command(purl, cmd) RETURNING ret, res
IF ret==0 THEN
RETURN purl
ELSE
LET msg=SFMT(%"Connection '%1' failed",r_cmd.oper),"\n URL:",purl,"\n",res
# CALL show_sync_err(msg)
LET purl='0'
END IF
END IF
RETURN purl
END FUNCTION