Web Services with PHP: Saying Dot Not to .NET
von
Luke Welling
RMIT University
Luke Welling and Laura Thomson are authors of the bestselling book, 'PHP
and MySQL Web Development' (Sams 2001) and the upcoming 'PHP Developer's
Handbook' (Sams 2002). They have taught numerous subjects at RMIT
University in Melbourne Australia, covering PHP, software engineering,
distributed programming and networking. They introduce PHP to hundreds of
new people each year. As Tangled Web (www.tangledweb.com.au) they provide
consulting and development services to a range of clients.
Web services are the next evolutionary step for the World Wide Web.
Rather than providing static data as pages, or forcing dynamic programs
to provide an interface to standards better suited to static files,
newer standards allow for greater interoperability and flexibility. Web
services are programs that provide functionality to others through
protocols such as SOAP. The services need to provide some metadata to
describe their functionality and interface, usually in the form of an XML Web
Services Description Language (WSDL) document. In order to be used by
others, web services can register themselves with a Universal Discovery,
Description and Integration (UDDI) directory. Web services are created
and provided so that they can be combined into new applications.
These services are based on open standards and protocols. It seems
only logical to use an open language to implement them.
While it is certainly possible to use SOAP, XML and UDDI under the
banner of Microsoft's .NET platform, it makes a lot of sense to utilise
the extensive web service support available in PHP, itself an Open
Source web scripting language. Using PHP and open standards will not
only allow you to do more with fewer resources, but also ensure that you
are not locked into using proprietary extensions to the standards.
In this tutorial, we will cover the terminology, concepts and
protocols that are usually described under the umbrella of web services.
We will also provide and examine sample code using PHP with SOAP, XML,
WSDL and UDDI. We will sum up with a discussion of what is needed for web
services to evolve from a useful tool for certain tasks to the normal way of
constructing web applications.