130 z/TPF and WebSphere Application Server in a Service Oriented Architecture
Figure 7-29 Preparing the JSP to add the service results
A new icon is placed at the location in the JSP where the results will be displayed, as shown
in Figure 7-30. The properties of the inserted expression item allow us to specify what result
we want to display — in our case, the hour value of the current z/TPF time. When we invoked
the service as part of the scriptlet above, we specified to have the results stored in the
timeResp variable. That is where we can retrieve the hour value now, shown in Example 7-3.
Figure 7-30 Retrieving the service result
Example 7-3 Content of the JSP expression to retrieve the hour value
timeResp.getHour()
Chapter 7. Web Service consumer 131
We continue the same pattern to retrieve the other values and display them as shown in
Figure 7-31.
Figure 7-31 Completed JSP
By clicking the Source tab of the JSP editor window, we can look at the HTML/JSP code that
makes up our JSP. The code should look similar to Example 7-4.
Example 7-4 JSP source
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>ShowTPFTime.jsp</TITLE>
</HEAD>
<BODY>
<P>This is a Java Server Page which utilizes a Web Service on z/TPF to retrieve
the current z/TPF system time.<BR>
<BR>
<jsp:useBean id="tpfService"
class="com.ibm.tpf.timeservice.TimePortProxy"></jsp:useBean><BR>
<%com.ibm.tpf.timeservice.GetTimeRequestMessage timeReq = new
com.ibm.tpf.timeservice.GetTimeRequestMessage();
com.ibm.tpf.timeservice.GetTimeResponseMessage timeResp;
timeResp = tpfService.getTime(timeReq);
%>
<BR>The current z/TPF system time is:<BR>

Get z/TPF and WebSphere Application Server in a Service Oriented Architecture now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.