Configure applications for web service

Create an application configuration file (.xcf) for a web services application.

What do you need to configure a Genero web service application? To add an application for a Genero web service, you need to specify:

  • Your application Id
    Note:

    Applications defined in the GAS configuration file require an Id attribute. For external configuration files, the Id attribute is ignored.

  • The parent application where the main configuration is set (in this example, ws.default)
    Important:

    The parent referenced must contain the prefix "ws.". For example, these are valid references: Parent="ws.default", Parent="ws.myservice".

  • The path to your compiled files
  • The main module to launch
  • The access control allowing access (optional)
  • The number of DVMs (fglrun) to start for this web service when the GAS starts, and the minimum and maximum number of DVMs allowed.
  • If you are using IIS as your web server, set the COMSPEC environment variable in your web service application configuration file.
    Tip:

    Set the value to what the DOS console returns for "echo %COMSPEC%".

    This variable must be set properly when the gwsproxy starts the fglrun process. You may have this environment variable set by IIS, however situations exist where the setting was not passed on; we ask that you explicitly set it as part of the configuration file for the web service.

These examples show well-formed application configuration for web service applications.

Example: simple web service application

In the following example the configuration is for a web service defined in the GAS configuration file. The PATH is a resource. The path can also be an absolute path to your application files. This configures a GWS server that any web service client can connect to.
  1. The application inherits the configuration settings of its parent ("ws.default" in this example).
  2. The path used in this example references a RESOURCE root for demo applications; you could also use the absolute path pointing to your application files.
<APPLICATION Id="calculator" Parent="ws.default">
  <EXECUTION>
    <PATH>$(res.path.fgldir.demo)/WebServices/calculator/server</PATH>
    <MODULE>calculatorServer</MODULE>
  </EXECUTION>
</APPLICATION>
Important:

When you add an application to the GAS configuration file, you must restart the GAS for the application to be recognized.

Example: web wervice Calculator.xcf

In the following example, if the file was named "Calculator.xcf", then this configuration file would accomplish the same task as when included in the GAS configuration file as in the example in Example: simple web service application. The main differences are the lack of the Id attribute and the addition of the reference to the XML schema.
Note:

As a DVM can have several services defined in it, the web Service DVM is an application. The services defined inside are still named service. The published functions are named operations.

  1. The ALLOW_FROM element specifies from what hosts access is allowed, the example here is defined in the res.access.control resource.
  2. The POOL element specifies the number of DVMs to start for this web Service when the GAS starts. In this example zero DVMs at start means the web service is not set to start with the GAS. And the maximum allowed is one DVM. For an example starting the service with the GAS, go to Configure service to start when GAS starts.

This example file can be found in $FGLDIR/demo/WebServices. In conjunction with the Example 2: "demo" group defined by resource definition, to access the WSDL of this demo, you can use this kind of URL:

http://appserver:6394/ws/r/demo/calculator?WSDL

<APPLICATION Parent="ws.default"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://www.4js.com/ns/gas/4.01/cfextws.xsd">
  <EXECUTION>
    <PATH>$(res.path.fgldir.demo)/WebServices/calculator/server</PATH>
    <MODULE>calculatorServer</MODULE>
    <ACCESS_CONTROL>
        <ALLOW_FROM>$(res.access.control)</ALLOW_FROM>
    </ACCESS_CONTROL>
    <POOL>
        <START>0</START>
        <MIN_AVAILABLE>0</MIN_AVAILABLE>
        <MAX_AVAILABLE>1</MAX_AVAILABLE>
    </POOL>
  </EXECUTION>
</APPLICATION>