com.WebServiceEngine.RegisterRestService

Registers a REST service in the engine.

Syntax

com.WebServiceEngine.RegisterRestService(
   module STRING, 
   basePath STRING )
  1. module registers the Genero BDL module of the REST service.
  2. basePath defines the 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.
Note: If your service has more than one module, use the com.WebServiceEngine.RegisterRestResources method instead.

The basePath sets the 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 Genero BDL 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")

You typically deploy the service behind a Genero Application Server (GAS). In the context of the GAS, you therefore have the group-name name (if not a member of the default group) and the service xcf-file filename in the URL. For example, the URL for the service's OpenAPI specification is:

http[s]://host:port/gas/ws/r[/group-name]/xcf-file/service-name?openapi.json

For instance, a URI to access the "users" operation is at:

http://myhost:6394/gas/ws/r/myGroup/myXcf/accounts/users

  • myhost:6394/gas/ws/r is the base URL from the server.
  • myGroup is the name of the group on the GAS where the web service is deployed.
  • myXcf is the name of the web service configuration .xcf file.
  • accounts is the name of the web service.
  • users is a resource-path of a specific resource operation set with WSPath.

For more information on resource URI, see REST resource URI naming practice.

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