I4GL migration guide / Migrate an I4GL web service provider to Genero |
I4GL uses Axis as server for its services, but Genero has its own server programmable via the COM library. Create a new file and add the IMPORT com instruction at beginning of the server file, then simply create the main loop in 4GL that will process any incoming HTTP request.
The port of the service defined in the I4GL .4cf configuration file (via the PORTNO entry) can be reused by setting the FGLAPPSERVER environment variable to the same value before to run the server. However only on development or for tests, on production Genero Web services requires an application server called GAS in charge of load balancing. See the GAS documentation for more details about port configuration for deployment purpose.
MAIN DEFINE ret INTEGER DEFER INTERRUPT # Create zipcode_details service CALL create_zipcode_details_web_service() # Start the server on port set in FGLAPPSERVER # (to be set to same value as PORTNO defined in the .4cf file) CALL com.WebServiceEngine.Start() # Handle any incoming request WHILE TRUE 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 # The Application server has closed the connection WHEN -3 DISPLAY "Client Connection lost." WHEN -4 DISPLAY "Server interrupted with Ctrl-C." WHEN -10 DISPLAY "Internal server error." END CASE IF int_flag<>0 THEN LET int_flag=0 EXIT WHILE END IF END WHILE END MAIN