Step 1: Get the WSDL description and generate server stub

Use the fglwsdl tool to generate the BDL server stub from a WSDL.

This tutorial uses the Calculator service defined in Example 1: Writing the entire server application to obtain the WSDL information. The fglwsdl -s module-name command generates a corresponding BDL server stub. You must provide the name of the GWS server application module ("serviceImp" in the sample) where the service finds the functions for the service operations at runtime:
fglwsdl -s serviceImp -soap12 -o example1 http://localhost:8090/MyCalculator?WSDL
Note:

The "MyCalculator" service must be running in order to obtain the WSDL information.

For an more information on using this command see Generate server stub file.

Note:

If you need to generate stub files that are compatible with your existing GWS client application using GLOBALS, see Get the WSDL description and generate legacy files.

The generated .4gl file

The generated stub file (example1Service.4gl in the example) contains a single function that creates the service, publishes the operation, and registers the service. The Web Service Style that is created is determined by the style specified in the WSDL information. The functions in this file accomplish the same tasks as Step 3: Create the service and operations and Step 4: Register the service of Example 1. Do not modify this file.
# example1Service.4gl
# Generated file containing the function Createexample1Service

IMPORT com
IMPORT FGL serviceImp    -- import the service operation module

# FUNCTION Createexample1Service
#   RETURNING soapstatus
FUNCTION Createexample1Service()
DEFINE service      com.WebService
DEFINE operation    com.WebOperation
  # Set ERROR handler
WHENEVER ANY ERROR GOTO error
  # Create Web Service
LET service = com.WebService.CreateWebService(
                             "MyCalculator",
                             "http://tempuri.org/webservices")

  # Publish Operation : Add
LET operation = com.WebOperation.CreateRPCStyle(
                                 "serviceImp.Add",
                                 "Add",
                                 Add,
                                 AddResponse)
CALL service.publishOperation(operation,"")
  # Register Service
CALL com.WebServiceEngine.RegisterService(service)
RETURN 0
  # ERROR handler
LABEL error:
RETURN status
  # Unset ERROR handler
WHENEVER ANY ERROR STOP
END FUNCTION