Steps to write a WS client / Calling a web service |
Provide values for the input and output messages of the operation, and call one of the generated functions. Since the input and output messages are simple integers, we can call the Add function.
MAIN DEFINE op1 INTEGER DEFINE op2 INTEGER DEFINE result INTEGER DEFINE wsstatus INTEGER LET op1 = 1 LET op2 = 2 CALL Add(op1, op2) RETURNING wsstatus, result IF wsstatus = 0 THEN DISPLAY "Result: ", result ELSE -- Use the global wsError record DISPLAY "Error: ", wsError.description END IF END MAIN
MAIN DEFINE wsstatus INTEGER LET Add.a = 1 LET Add.b = 2 LET wsstatus = Add_g() IF wsstatus != 0 THEN -- Use the glocal wsError record DISPLAY "Error :", wsError.Description ELSE DISPLAY "Result: ", AddResponse.r END IF END MAIN
These examples are very basic versions of the code. For complete examples, see the code samples provided with the package in demo/WebServices.