Using the generated functions
The WSDL information obtained from the Web Service allows you write client applications that use the service.
The information about the Add function from the ws_calculator.inc file, for example, allows you to write code in your own .4gl module that uses this operation as part of your Client application.
Using parameters and return values
FUNCTION myWScall()
DEFINE op1 INTEGER
DEFINE op2 INTEGER
DEFINE result INTEGER
DEFINE wsstatus INTEGER
...
LET op1 = 6
LET op2 = 8
CALL Add(op1, op2)
RETURNING wsstatus, result ...
DISPLAY result
Using global records
FUNCTION myWScall()
DEFINE wsstatus INTEGER
...
LET Add.a = 6
LET Add.b = 8
LET wsstatus = Add_g()
...
DISPLAY AddResponse.r
In this case, the status is returned by the function, which has also put the result in the AddResponse global record.
See Tutorial: Writing a Client Application for more information. The demo/WebServices subdirectory of your Genero installation directory contains complete examples of Client Applications.
Using asynchronous calls
FUNCTION sendMyWScall()
DEFINE wsstatus INTEGER
...
LET Add.a = 6
LET Add.b = 8
LET wsstatus = AddRequest_g()
IF wstatus <> 0 THEN
DISPLAY "ERROR :", wsError.code
END IF
...
FUNCTION retrieveMyWScall()
DEFINE wsstatus INTEGER
...
LET wsstatus = AddResponse_g()
CASE wstatus
WHEN -2
DISPLAY "No response available, try later"
WHEN 0
DISPLAY "Response is :",AddResponse.r
OTHERWISE
DISPLAY "ERROR :", wsError.code
END CASE
...
You can mix the asynchronous call with the synchronous one as they are using two different requests. In other words, you can perform an asynchronous request with AddRequest_g, then a synchronous call with Add_g, and then retrieve the response of the previous asynchronous request with AddResponse_g.