API Tutorial Lesson 14 - Calling a Method from Front-End Software
Finally, this lesson demonstrates how, after all developer's tasks have been completed to define a method, it can now be called on behalf of any standard user. The sample code shown in the Figure is minimal end-user software, calling just one method of one solution.
In order to run the method, the solution it is part of must be identified by a clone solution token. Also, the user on whose behalf the method will be run must already have logged into the transaction manager (represented by the call to the 'UserLoginAllow' API) and the solution. This second login, represented by the call of the 'SolutionLoginAllow' API and ended by the call to 'SolutionLoginCommit' API does not require any user input (or even knowledge by the user that they are called), but is required by our transaction manager in order to, among others, limit the time period the user will be able to call the solution's methods. Note that in more complex environments, a single front-end software could include calls to methods of different solutions, and would have to log in the user into each corresponding solution over time.
In order to request that our cloud-based time-limited transaction manager effectively runs the functionality associated to a method, the three APIs 'MethodInvokeAllow', 'MethodInvokeParameterAdd' and 'MethodInvokeCommit' need to be called: the first one starts the method running transaction, the second one adds the values to be used for the method's parameters (and will be thoroughly checked, as with any other API call), while 'MethodInvokeAllow' confirms the methods execution (which will imply in, if defined, running all callbacks associated to the method).
If the method's return value is needed inside the end-user software (this will only be needed if at least one callback has been associated to the method), then it must be retrieved after a succesful method call by calling the 'CallbackInvokeGet' API, using the operation handle returned by 'MethodInvokeAllow' as its only parameter (and which is not valid any more to handle the transaction, but enough to retrieve the return value from the call log). The CallbackInvokeGet' API also takes the callback's name as a parameter, so that it can be used to retrieve the return value for any specific callback run as part of the method call.
US Patent Requested