Get service information from Web service

Using the fglrestful tool, you can generate the client stub directly from a REST Web service URL or an OpenAPI specification file.

The following steps describe the options.

  1. Use the fglrestful tool to generate the stub.
    For example, from the Web service URL
    fglrestful -o clientStub http://host:port/gas/ws/r/group/xcf/resource?openapi.json
    For example, from an OpenApi service specification file
    fglrestful -o clientStub service-spec-file
    Where:
    1. clientStub specifies the file name of the stub in the output (-o) option.
    2. The URL of the Web service is specified with the query string ?openapi.json to get the specification file.
      Note: The GWS REST service must be running on the specified port in order to provide the service information.

      The stub file can also be generated from a file containing the specification as shown in the second example.

    The clientStub.4gl is generated from the specification. It contains the complete code to manage calls made by client applications to the Web service resources. You need to compile and import in the module into your Genero REST client application. For details, see Call the stub functions.

  2. Alternatively, to view the specification in the browser, you can use the Web service URL with the ?openapi.json query string.
    https://host:port/gas/ws/r/group/xcf/resource?openapi.json
    The OpenAPI specification is displayed formatted in JSON. You can copy and paste the output and save to a file. The stub file can be generated as described in the second example in step 1.
    Note: If you can not access the service because it is protected, you must get the access token using the getToken tool as described in Get service information from secure Web service. For further information, see the GetToken page in the Genero Application Server User Guide.