Get service information from secure Web service

To access a secure Web service, including its documentation, you need an access token issued on behalf of an authorized user.

You can get the token using the GetToken tool and provide it in the URL query string to get the OpenAPI documentation.

The GetToken tool is located in the FGLDIR/web_utilities/services/gip/bin/gettoken directory.

The following steps describe the process.

  1. Use the GetToken tool to get the access token.
    Line breaks have been added to the command example to improve readability.
    GetToken password -u user -p mypw 
    --idp https://myhost:6394/gas/ws/r/services/GeneroIdentityProvider
    --savetofile mytoken.json myWSScope
    Where:
    1. The password command is used to get an access token on behalf of an authenticated user.
    2. The user name and password provided (-u user -p mypw) is that of a registered user in the IdP.
    3. The URL of the Genero Identity Provider (GIP) is specified in the --idp option.
    4. mytoken.json is the filename where the access token is saved.
    5. myWSScope is the scope of the service required in the token.

    The access token is valid for 10 minutes.

    For further information, see the GetToken page in the Genero Application Server User Guide.

  2. Add the token in the Web service URL query string to get the documentation.
    http://myhost:6394/gas/ws/r/myGroup/myXcf/myService?openapi.json&access_token=_d$r6K.RJ
    The OpenAPI documentation is displayed in the browser formatted in JSON. You can copy and paste the output and save to a file. The stub file can be generated as described in Get service information from Web service.
  3. Or alternatively, you can use the token with the fglrestful tool to generate the stub.
    fglrestful -o clientStub -k tokenfile http://myhost:6394/gas/ws/r/myGroup/myXcf/myService?openapi.json
    Where:
    1. clientStub specifies the filename of the stub in the output (-o) option.
    2. The token is specified in the token file, with the -k option. You can use -t option instead followed by the token value but this may be very long. It is recommended to use a token file.
    3. The URL of the Web service is specified with the query string ?openapi.json to get the documentation file.

      The GWS REST service must be running on the specified port in order to provide the service information.

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