Configure a web service

Create a configuration file with the details the Genero Application Server needs to deliver the web service to client applications.

The configuration file for a web services is very similar to that used for applications.

For the purposes of this quick start, you can create a custom configuration file for the Calculator web service located in your $FGLASDIR/demo/WebServices/calculator/ directory.

  1. Create a new directory (for example, you can name it "calculator_config") on your disk where you will store the Calculator web service runtime files.
  2. Copy all the files from $FGLASDIR/demo/WebServices/calculator/server to your new local directory.
  3. Create a minimal configuration file for your Calculator web service. Provide a path to the location of your compiled application files in the PATH element, and in the MODULE element specify the module required to launch your web service.
    Use a text editor or if you are using Studio, go to File >> New >> Web/AS >> Application Configuration (.xcf).
    <?xml version="1.0" encoding="UTF-8" ?>
    <APPLICATION Parent="ws.default" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:noNamespaceSchemaLocation="http://www.4js.com/ns/gas/5.00/cfextws.xsd">
     <EXECUTION>
       <PATH>path_to_your_local_directory</PATH>
       <MODULE>CalculatorServer.42r</MODULE>
     </EXECUTION>
    </APPLICATION>
    Where:
    • The Parent attribute reference to ws.default provides default configuration for all applications of the web service type.
    • In the PATH element, you provide an absolute path to the location of your compiled application files.
    • In the MODULE element, you specify the module required to launch your application.
  4. To test, save the web service configuration file in a GAS services group directory.

    You can save the xcf, for example, mycalculator.xcf in the default service group, $(res.appdata.path)/services, directory, or in your own defined group. Alternatively, you can deploy the service.

    You have successfully configured an application.