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 documentation file.
The following steps describe the options.
-
Use the fglrestful tool to generate the stub.
For example, from the Web service URL
fglrestful -o clientStub http://myhost:6394/gas/ws/r/myGroup/myXcf/myService?openapi.json
For example, from an OpenAPI service documentation filefglrestful -o clientStub service-spec-file
Where:- clientStub specifies the filename of the stub in the output
(
-o
) option. - 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 stub file can also be generated from a file containing the documentation as shown in the second example.
The clientStub.4gl is generated from the documentation. 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.
- clientStub specifies the filename of the stub in the output
(
-
Alternatively, to view the documentation in the browser, you can use the web service URL with
the ?openapi.json query string.
https://myhost:6394/gas/ws/r/myGroup/myXcf/myService?openapi.jsonThe OpenAPI documentation 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.
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.