Obtaining the WSDL information

Before accessing a SOAP Web service, you must get the WSDL information from the service provider.

Sample services can be found through UDDI registries or on other sites such as XMethods (http://www.xmethods.net).

You can use the fglwsdl tool provided by the Genero Web Services package to obtain the necessary WSDL information. The following example obtains the WSDL information for the GWS Service MyCalculator created by the Writing a Web server application:
fglwsdl -soap12 -o Example2Client http://localhost:8090/MyCalculator?WSDL
This generates two files:
  • Example2Client.inc - the globals file containing the definitions of the input and output records, and the prototypes of the operations.
  • Example2Client.4gl - a module containing the definitions of the functions that can be used in your GWS client application to perform the requested Web Service operation, and the code that manages the Web Service request.
Note: The MyCalculator GWS Service must be running on the specified port in order to provide the WSDL information.

The following definitions were generated in the globals file, Example2Client.inc:

Input and Output records

DEFINE Add RECORD 
  ATTRIBUTES( XMLName="Add", 
             XMLNamespace="http://tempuri.org/webservices" )
  a INTEGER ATTRIBUTES( XMLName="a", XMLNamespace="" ),
  b INTEGER ATTRIBUTES( XMLName="b", XMLNamespace="" )
END RECORD

DEFINE AddResponse RECORD 
  ATTRIBUTES( XMLName="AddResponse", 
             XMLNamespace="http://tempuri.org/webservices" )
  r INTEGER ATTRIBUTES(XMLName="r",XMLNamespace="" )
END RECORD

The data types are defined as global or modular variables.

Function prototypes for the Operations

This globals file contains the prototype of two functions for the Add operation.

The Add function uses input and output parameters, and returns the status and result. This function can only be used if the input and output parameters are not complex structures such as arrays or records. Using this function, developers do not access the global records directly.

The Add_g function can be used with the global input and output records. Before calling this function, you must set the values in the variables of the global input record.

Operation: Add
#
# FUNCTION: Add_g()
# RETURNING: soapStatus
# INPUT: GLOBAL Add
# OUTPUT: GLOBAL AddResponse
#
# FUNCTION: Add(p_a, p_b)
# RETURNING: soapStatus ,p_r

See fglwsdl and WS client stubs and handlers for more details regarding the fglwsdl tool, its output and the generated functions.