Step 3: Create service, start server and process requests

Code to start the Genero Web Services (GWS) Server.

Create your own MAIN module that calls the function from the generated .4gl file to create the service, then starts the Genero Web Services Server and manages requests as in Step 5: Start the GWS server and process requests of Example 1: Writing the entire server application.
# example2main.4gl file -- contains the MAIN program block

IMPORT com

GLOBALS "example1Service.inc"

MAIN
   DEFINE create_status INTEGER

   DEFER INTERRUPT

   CALL Createexample1Service()  -- call the function generated 
                                 -- in example1Service.4gl 
      RETURNING create_status
   IF create_status <> 0 THEN
      DISPLAY "error"
   ELSE
      # Start the server and manage requests
      CALL ManageService()
   END IF

END MAIN

FUNCTION ManageService()
   DEFINE ret INTEGER
   CALL com.WebServiceEngine.start()
   WHILE TRUE
   # continue as in Step 5 of Example 1
   ...
END FUNCTION