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:
- Import the client stub module
 - If you are accessing a secure service, code within the 
MAINprogram block to get the access token before calling any functions. See Main program code for access to secure service. - Call the functions within the 
MAINprogram 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.