Before you start
This tutorial is for PHP programmers that would like to jump on the Web services bandwagon by creating a Web service in PHP. You'll build a Web service by building a SOAP server in PHP. The Web service you will create will be a vehicle lookup service that takes in queries based on make, model, and year. The Web service will then query an internal database and respond appropriately. A Web-based client will also be coded in PHP to communicate and query the SOAP server. It creates a chain of three SOAP servers in PHP. In reality, each of the three servers would be placed in three different physical locations or cities where a chain of car dealerships would coexist. The client would then be hosted at one location where car customers would come and visit, entering search queries to find the vehicles of their dreams. The client routes the query to each of the three SOAP servers, which, in turn, send results back to the client. Upon receiving each response, the client displays the search results to the user for analysis.
The following tools are needed to follow along:
- Web server
- Any operating system and any Web server can be used. Feel free to use Apache V2.X, or IBM's HTTP Server; download from Apache or from IBM.
- Due to the use of PHP data objects, PHP V5.1 or later is required. Be sure to configure with the following option to include support for Derby and the SOAP extensions:
--with-pdo-odbc=ibm-db2,/home/db2inst1/sqllib --enable-soap. See Resources for information about configuring Apache or IBM's HTTP Server with PHP.
- This tutorial uses Apache Derby, which is open source and lightweight. Also download the IBM DB2® JDBC Universal Driver and the DB2 Run-Time Client. Make sure to set your
CLASSPATHappropriately by following the instructions on each page. You can follow the Linux® or Windows® instructions for installing and downloading the DB2 Run-Time Client. See Resources for more information to help you get the configuration right.
IBM Cloudscape may also be used for this tutorial. The internals of it are the same as Derby; however, the DB2 JDBC Universal Driver and other things are packaged into Cloudscape, and it is supported by IBM. Download IBM Cloudscape V10.1 and the DB2 Run-Time Client from IBM.