Write the MAIN program code block

Import the client stub, and call its functions.

To call a REST service function, in your client's main module, you:
  1. Import the client stub module
  2. If you are accessing a secure service, code within the MAIN program block to get the access token before calling any functions. See Main program code for access to secure service.
  3. Call the functions within the MAIN program block
IMPORT FGL clientStub
MAIN
  DEFINE wsstatus INTEGER
  DEFINE rets STRING
  DEFINE opt1 INTEGER
  LET opt1=22

  CALL clientStub.getUsersName(opt1) RETURNING wsstatus, rets
  
  IF wsstatus = clientStub.C_SUCCESS THEN
    DISPLAY "User name is :",rets
  ELSE
    DISPLAY "Error in getting user details"
  END IF
  
END MAIN

This example is a very basic version of the code. Find a client application at $FGLDIR/demo/WebServices/books.