Writing a Web server application / Example 1: Writing the entire server application |
Once you have registered the Web Service(s), you are ready to start the Genero Web Services (GWS) Server and process the incoming SOAP requests.
The GWS Server is located on the same physical machine where the application is being executed (In other words, where fglrun executes).
This is the MAIN program block of your application.
MAIN DEFINE ret INTEGER
CALL createservice()
CALL com.WebServiceEngine.Start()
WHILE TRUE # Process each incoming requests (infinite loop) LET ret = com.WebServiceEngine.ProcessServices(-1) CASE ret WHEN 0 DISPLAY "Request processed." WHEN -1 DISPLAY "Timeout reached." WHEN -2 DISPLAY "Disconnected from application server." EXIT PROGRAM WHEN -3 DISPLAY "Client Connection lost." WHEN -4 DISPLAY "Server interrupted with Ctrl-C." WHEN -10 DISPLAY "Internal server error." EXIT PROGRAM WHEN -15 DISPLAY "Server was not started." EXIT PROGRAM OTHERWISE DISPLAY "ERROR: ", STATUS, SQLCA.SQLERRM END CASE IF int_flag<>0 THEN LET int_flag=0 EXIT WHILE END IF END WHILE DISPLAY "Server stopped" END MAIN