Set Timeout for web services rest call using ASYRRESTCLI.EXEC_REST_WS

When launching a request via REST web service with the ASYRRESTCLI.EXEC_REST_WS instruction against a third party Endpoint, I need to control a certain time in which, if the Endpoint does not respond, to exit the call and return error by TimeOut.

Currently, if the Endpoint is stopped, the process runs and I don't know for how long, because when it took more than 15 minutes I stopped it.

Looking for information, I have tried putting this in the header parameters:
# Add a parameter
HCOD(1) = 'xxx-api-key'.
HVAL(1) = '"'+PCONEXPWD+'"''
HCOD(2) = 'Content-Type'
HVAL(2) = '"application/json"''
HCOD(3) = 'Keep-Alive'
HVAL(3) = '"timeout=1"''

But it still does not stop at one minute

Thank you very much, in advance, for the answers.

Parents Reply Children
  • in reply to Regard Hulsbos

    I have tried with FUTURE mode, but I got nothing. My code is as follows:
    RETVAL=func ASYRRESTCLI.EXEC_REST_WS("REST_MOTOR_INTEGRA", "POST",PCONEXDIR,PCOD,PVAL,HCOD,HVAL,PJSON,1,'',RESHEAD,RESBODY)
    If find(RETVAL,200,201) <> 0 Then
    Local Char ZUUID(250) : ZUUID = RESBODY
    Sleep 30
    RETVAL= func ASYRWEBSER.GET_FUTURE(ZUUID,RESHEAD,RESBODY)
    Endif

    What happens is that with EXEC_REST_WS it returns RETVAL=200 immediately, but when GET_FUTURE is executed it is in process until the maximum time stipulated.

    I don't know if I'm executing the code right or not, is this how it has to be done?

    Thanks