SOAP Webservice Gateway Timeout

Started by Bothwell W., March 08, 2022, 03:20:04 PM

Previous topic - Next topic

Bothwell W.


Good Day

How can I correctly handle " Gateway Timeout "  when my Web Operation function takes too long to complete ? in my code I have:

Code (genero) Select


WHILE TRUE

    CASE com.WebServiceEngine.ProcessServices(-1)

     WHEN 0
         COMMIT WORK

     WHEN -2
          ROLLBACK WORK

      ---

     OTHERWISE
          ROLLBACK WORK
     
END WHILE



While testing a long running process I see that com.WebServiceEngine.ProcessServices() first returns 0 then later returns -2 . so I am not sure how to tell when there is timeout as I am geting both a success and error status on the same request.

the documentation  here: https://4js.com/online_documentation/fjs-fgl-3.00.05-manual-html/c_gws_ComWebServiceEngine_ProcessServices.html mentions a status 0 for a successful web operation so I was not expecting status 0 when the webservice has not replied with the data.

Basically the webservice reads data from a single table and updates a status field in the table to sent.

Is there a better way or the correct class that I should be using ?

crying g.

Quote from:  . on March 08, 2022, 03:20:04 PM

Good Day

How can I correctly handle " Gateway Timeout "  when my Web Operation function takes too long to complete ? in my code I have:

Code (genero) Select


WHILE TRUE

    CASE com.WebServiceEngine.ProcessServices(-1)

     WHEN 0
         COMMIT WORK

     WHEN -2
          ROLLBACK WORK

      ---

     OTHERWISE
          ROLLBACK WORK
     
END WHILE



While testing a long running process I see that com.WebServiceEngine.ProcessServices() first returns 0 then later returns -2 . so I am not sure how to tell when there is timeout as I am geting both a success and error status on the same request.

the documentation  here: https://4js.com/online_documentation/fjs-fgl-3.00.05-manual-html/c_gws_ComWebServiceEngine_ProcessServices.html mentions a status 0 for a successful web operation so I was not expecting status 0 when the webservice has not replied with the data.

Basically the webservice reads data from a single table and updates a status field in the table to sent.

Is there a better way or the correct class that I should be using ?

When dealing with a "Gateway Timeout" error in your web operation function, it's important to handle it correctly to ensure proper execution and error handling. In your code, you can modify the handling of the "Gateway Timeout" error as follows:

pgsql
Copy
WHILE TRUE
   CASE com.WebServiceEngine.ProcessServices(-1)
   WHEN 0
      COMMIT WORK
   WHEN -2
      ROLLBACK WORK
   WHEN -31
      -- Handle Gateway Timeout error here
      -- You can perform any necessary actions, such as logging or retrying the operation
   OTHERWISE
      ROLLBACK WORK
END WHILE