com.WebServiceEngine.RegisterRestService

Registers a REST service in the engine.

Syntax

com.WebServiceEngine.RegisterRestService(
   module STRING 
   basePath STRING )
  1. module registers the module of the REST service.
  2. basePath defines the base path to the Web service as it appears in the URL.

Usage

You use this method to register all the public functions in the module of your Web service with the Genero Web Service engine and publish them for users on the internet.

It is recommended to import the Rest service module with the IMPORT FGL statement. Alternatively, you can link .42r files using the fgllink command.

The basePath sets the base path to the Web service in the Genero Web Service engine as it appears in the URL for the service. For instance, if you want your 4GL module called "accounts" to be published as a Rest service with the name "Accounts" (uppercase "A") you must call the function as shown:

CALL com.WebServiceEngine.RegisterRestService("accounts","Accounts")
Then the URL is: http://host:port/gas/ws/r/group/xcf/Accounts
Note: Typically, you deploy the service behind a Genero Application Server, and therefore you have also the group name (if not the default) and the service xcf file name in the URL.

In direct mode on a localhost, the URL is just: http://localhost:port/ws/r/Accounts

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).