iTP Active Transaction Pages (iTP ATP) Programmer's Guide
ATP Web Page and Script Structure
iTP Active Transaction Pages (iTP ATP) Programmer’s Guide—522292-002
3-14
Using NonStop TUXEDO Servers from JavaScript
2. Creates a new atp.fml_buffer object to represent the message to send to the
NonStop TUXEDO server.
3. Uses the setData method of the atp.fml_buffer object to fill the buffer with
data supplied by the function caller. The data comes from fields in the
atp.request object, as you see in the function call. To fill multiple fields, a
script must invoke the setData method once for each field.
4. Creates a new atp.transaction object to protect the transaction. (The
transaction object could have been created before the FML table and buffer objects.)
5. Invokes the tpcall method on the buffer object, specifying the required TUXEDO
service and the transaction object. (The transaction begins at this time.)
6. Rolls back the transaction and returns an error in the case of a failure. The error
property of the buffer object identifies the error from the NonStop TUXEDO call,
and the error_text property describes the error. STATLIN is a standard error
message defined by NonStop TUXEDO.
7. Commits the transaction and returns the resulting account balances if the request
was successful. The script uses the getData method to extract the two new
balances from the reply property of the atp.fml_buffer object. The reply
property is itself an atp.fml_buffer object, created automatically by the
tpcall method. The parameters supplied to getData identify a field from the
atp.fml_table object and an optional subscript.
Upon return from the doTransfer function, the script prints a message if the function
returned an error.
Displaying Results
To display the results, the script
(/examples/tuxedo/bankapp/transfer.atp) reads the new data from the
cache, using an atp.SQL object and methods. The script uses the global function
atp.formatMoney to format the account balance for presentation.
The script in Example 3-7
displays the new data on an HTML form, using server-side
JavaScript to implement the loop that prints the table data: