com.WebServiceEngine.HandleRequest

Get a handle for an incoming HTTP service request.

Syntax

com.WebServiceEngine.HandleRequest(
   timeout INTEGER,
   status RECORD  )
  RETURNS com.HTTPServiceRequest
  1. timeout defines the timeout in seconds.
  2. status defines the variable receiving the method execution status.

Usage

The com.WebServiceEngine.HandleRequest() class method returns a com.HTTPServiceRequest object to handle an incoming HTTP request, or NULL if there was no request during the given period of time.

The timeout parameter defines the time in seconds to wait for an incoming request. A value of -1 means infinite wait.

  • If there is no request in the given period of time, or if there is an error, the status code is updated by reference, and a NULL object is returned.
  • If the request is intended for a registered web service, it is processed automatically. The status code is updated by reference and a NULL object is returned.
  • If the request isn't dedicated to a registered web service, a status code of value 1 is returned by reference, and a valid instance of an com.HTTPServiceRequest object, immediately usable to handle the incoming request, is returned.

In case of error, the method throws an exception and sets the STATUS variable. Depending on the error, a human-readable description of the problem is available in the SQLCA.SQLERRM register. See Error handling in GWS calls (STATUS).

Any new call to this function will raise an error until the previous HTTP request was handled by sending a response back to the client, or destroyed.

The status returned by the method provides information about the execution of the last web operation. A return status of zero means OK. For a complete list of error codes, see Error codes of com.WebServicesEngine

Note: If the com.WebServiceEngine.Flush() method is used, the return status handling must be done in the web operation function, while com.WebServiceEngine.HandleRequest() will return the code -31, to indicated that a flush was done.

The error -15575 can be thrown if the GAS disconnects the Web Services program.

URLs are sent in UTF-8 on the network, if the web services server is not able to convert UTF-8 URLs back to fglrun locale charset, error -15552 will be thrown. As a general advice, run you WS server program in UTF-8.