Obtaining the WSDL information

To access a remote 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 -o Example2Client http://localhost:8090/MyCalculator?WSDL
This generates two files:
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 
  ATTRIBUTE( XMLName="Add", 
             XMLNamespace="http://tempuri.org/webservices" )
  a INTEGER ATTRIBUTE( XMLName="a", XMLNamespace="" ),
  b INTEGER ATTRIBUTE( XMLName="b", XMLNamespace="" )
END RECORD

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

Since BDL functions cannot have complex structures as parameters, 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 Client stub and handlers for more details regarding the fglwsdl tool, its output and the generated functions.