beautypg.com

Returning the results to the client – HP NonStop G-Series User Manual

Page 273

background image

'// Choose the response template
If IsEmpty(Application("templates")) Then
Set template = Server.CreateObject("BEAWEB.Template")
Else
Select Case Request("SVCNAME")
Case "INQUIRY"
Set template = Application("templates")(INQUIRY)
Case "DEPOSIT"
Set template = Application("templates")(DEPOSIT)
Case "WITHDRAWAL"
Set template = Application("templates")(WITHDRAWAL)
Case "TRANSFER"
Set template = Application("templates")(TRANSFER)
End Select
End If

Next, call the TUXEDO service. In this example, the input data from the request object is passed
to the call() method of the session. The call() method uses the built-in ASP Request object as
input. The results of the call() are stored in the output object and an array, iodata.

Example 3-7. tlr.asp: Invoke the TUXEDO Service

Set output = pool.call(Request("SVCNAME"), Null, Nothing)
Set iodata(1) = output

After you invoke the TUXEDO service, the output object and the second element of the array
iodata contain the results of the service call.

Note

In this example, because the initial form specified field names match the TUXEDO service
parameter names, the Request object can be used in the call() method. If these names do not
match, create an input array with "name=value" elements for each service parameter before
invoking the call() method.

Returning the Results to the Client

At this stage, no results have been returned to the client. The final step sends an HTML page
containing the results of the service call back to the client. The HTML page consists of the
template merged with the data returned by the service call shown in

Example 3-7

.

The template file contains placeholders for variable (call specific) data. These placeholders are
identified by the special tag <%=NAME%>. In the code example shown in

Example 3-8

, an index

is used to indicate which occurrence of a parameter name is used. For example, ACCOUNT_ID[0]
specifies the first occurrence of the field ACCOUNT_ID.

Example 3-8. transfer.temp: Placeholders for TRANSFER Results