Chapter 28

Consuming SOAP Web Services

In the previous lesson you learned how to parse an XML file. In this lesson you learn to communicate with web services by using XML-based messages and responses.

A web service is essentially a web application that runs on a web server and provides a list of methods to its users. You access the web service as you would any other website, using a URL.

You need to know the URL at which a web service is located beforehand, and more often than not, you also need to know the list of methods provided by the web service. Some web services include an additional file on the web server that provides a list of methods contained in the web service. This file is known as the WSDL file. WSDL is an acronym for Web Service Description Language.

Web services themselves can be written using one of several technologies including PHP, ASP.NET, and ColdFusion. Creating a web service is outside the scope of this book.

The examples in this lesson use a simple web service called MathService. This is a PHP-based web service and can be accessed at:

If you point your browser to that URL, you will see the WSDL file for the service, which contains a list of method names exposed by this web service (Figure 28-1).

Table 28-1 lists the methods provided by the web service and a brief description of each.

Get iPhone and iPad App 24-Hour Trainer now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.