Chapter 7. Web Service consumer 147
timeResponse = theTPFTimeService.getTime(new GetTimeRequestMessage());
System.out.println("TPF Time is: " + timeResponse.getHour() + ":" +
timeResponse.getMinute() + ":" + timeResponse.getSecond());
} catch(Exception e) {
System.out.println(“An error occurred while retrieving the z/TPF system
7.3 Web Service consumer with PHP
PHP is a Web centric scripting language which has become quite powerful in recent years
and a large number of Web Applications are based on it or at least utilize it for their
presentation layer.
PHP 5 includes a SOAP library that makes it very easy to use Web Services over SOAP and
below. We show you just how easy it is to use our z/TPF base time service from within a PHP
scripted Web Page.
7.3.1 Enable PHP on a Web server
PHP is released under its own open source license, PHP license 3.1. Source packages for
the PHP runtime can be obtained from the official PHP Web site at:
There are quite a few companies supporting PHP and distributing pre-compiled PHP
packages for several platforms. Among those companies, Zend Technologies Ltd is one of the
biggest supported behind PHP and they have several pre-compiled packages available that
work well in conjunction with IBM Servers and databases.
It is outside of the scope of this book to explain how to install and enable PHP on a Web
Server, but we refer you to the following book, which provides a lot more detail: Developing
PHP Applications for IBM Data Servers, SG24-7218.
Additional resources are readily available on the Internet as well.
7.3.2 Getting the WSDL
As a starting point for our development we require the WSDL document for the z/TPF based
time service again. We had used the same WSDL document previously to create the JSP
client, and we provide its source code in Example 7-6 for easier referencing.
Example 7-6 WSDL document
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns=""
xmlns:xsd="" name="TPFService"
148 z/TPF and WebSphere Application Server in a Service Oriented Architecture
<xsd:schema elementFormDefault="unqualified"
<xsd:complexType name="GetTimeResponseMessage">
<xsd:element name="Hour" type="xsd:string"></xsd:element>
<xsd:element name="Minute" type="xsd:string"></xsd:element>
<xsd:element name="Second" type="xsd:string"></xsd:element>
<xsd:complexType name="GetTimeRequestMessage">
<xsd:element name="GetTimeRequest"
<xsd:element name="GetTimeResponse"
<wsdl:message name="GetTimeRequest">
<wsdl:part name="GetTimeRequest" element="tns:GetTimeRequest"></wsdl:part>
<wsdl:message name="GetTimeResponse">
<wsdl:part name="GetTimeResponse" element="tns:GetTimeResponse"></wsdl:part>
<wsdl:portType name="TimePort">
<wsdl:operation name="GetTime">
<wsdl:input message="tns:GetTimeRequest"></wsdl:input>
<wsdl:output message="tns:GetTimeResponse"></wsdl:output>
<wsdl:binding name="TimePortBinding" type="tns:TimePort">
<soap:binding transport=""
<wsdl:operation name="GetTime">
<soap:operation soapAction="getTime" style="document"/>
<soap:body use="literal"/>
<soap:body use="literal"/>
<wsdl:service name="TPFService">
<wsdl:port name="TimePort" binding="tns:TimePortBinding">
<soap:address location="" />

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.