Step 2: Write a BDL function for your service operation

Using the information from the files generated in Step 1: Get the WSDL description and generate files, the Add operation from Example 1: Writing the entire server application is rewritten to have different functionality but to still be compatible with the WSDL description of the operation.

This step accomplishes the same thing as Step 2: Write a BDL function for each service operation in Example 1. In this version of the add operation, the sum of the two numbers in the input record is increased by 100.

# my_function.4gl                         -- file containing the function 
                                          -- definition
IMPORT com                                -- import the Web Services library

GLOBALS "example1Service.inc"             -- use the generated globals file
#User Public Functions
FUNCTION add()                            -- new version of the add function
LET AddResponse.r = (Add.a + Add.b)+ 100  -- the global input and output 
                                          -- records are used
END FUNCTION