Configure applications for Web service

Create a 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, if the application and the configuration file share the same name, there is no need to specify the Id attribute.
  • 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 Service 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.

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

See Web services URI information.

<APPLICATION Parent="ws.default"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://www.4js.com/ns/gas/3.10/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>