com.WebServiceEngine.ProcessServices
Wait for an HTTP input request to process an operation of one of the registered SOAP or REST Web Services.
Syntax
com.WebServiceEngine.ProcessServices(
timeout INTEGER )
RETURNS INTEGER
- timeout defines the timeout in seconds.
Usage
The com.WebServiceEngine.ProcessServices() method
processes requests made by client apps for operations of a SOAP or REST web service registered by
the Genero Web Service engine. Typically, you call the method inside a WHILE loop
to process the various requests and control the workflow for all requests made by clients. As long
as the int_flag variable is
FALSE or the execution status is valid, the condition within the
loop remains TRUE and requests are executed.
The timeout parameter defines the wait period (in seconds) the method may wait to process a request. The value -1 specifies an infinite waiting time.
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, go to Error codes of com.WebServiceEngineThe execution status is typically handled in a
CASE / END CASE block, to treat all possible execution cases.
Besides zero, the method can return, among others:
| Status | Returned when | Resolution/Additional notes |
|---|---|---|
| -5 | The request is not valid HTTP: a malformed request line, an unknown method, an unsupported HTTP version, or a URL path that cannot be decoded. In versions earlier than FGLGWS 6.00.03, these requests return -8. | Starting from FGLGWS 6.00.03, the server responds to the client with an HTTP error status (501 for an unknown method, 505 for an unsupported HTTP version, and 400 for other invalid requests) and keeps running, so the application can process later requests. In earlier versions, such a request puts the GWS HTTP server into an invalid state. Even if the application traps the exception, every later call fails with the same error. The application must then shut down cleanly and exit. |
| -8 | The request fails with an HTTP error. In versions earlier than FGLGWS 6.00.03, also a request that is not valid HTTP. | Check the error with FGLWSDEBUG. |
| -9 | The service is unknown, or the request calls a SOAP service with a method other than GET or POST. | Check the service name in the URL. For a SOAP service, use GET or POST. The server sends an HTTP error response to the client and keeps running. |
| -31 | The web operation called com.WebServiceEngine.Flush(). |
Not an error: the web operation sent its response early. Check the status that Flush() returns inside the web operation function. For details and an example, go to com.WebServiceEngine.Flush. |
| -35 | No REST operation matches the request path, method, and media type (the
Accept or Content-Type header). |
Check the URL of the resource, the HTTP method and headers, and the REST web service function parameters. The server sends an HTTP error response to the client and keeps running. |
In earlier versions, with GAS 6.00.04 or later, this is not an issue in production environments: the Genero Application Server (GAS) and GWSProxy detect the ended DVM, return an HTTP error code to the client app, and any new request starts a new DVM in a clean state through GWSProxy and the pool configuration.
Example: Handle HTTP requests
When you need to intercept and respond to unregistered services or implement custom endpoints,
use com.WebServiceEngine.HandleRequest instead of
com.WebServiceEngine.ProcessServices()