It is becoming more apparent these days that applications can no longer live in a vacuum, but are instead required to interact with other systems in some way or another. There isn't one great big chunk of code on a mainframe computer dealing with absolutely everything anyone could need. Phrases like "loosely coupled" and "code-reuse" are winning the day because they make it easy for developers to effectively "piggy-back" a ride on the work of others or, at the very least, separate and isolate different functionalities, making it easier to modify or maintain their code.
Code reuse implies that once something is done, we don't need to reinvent it. Instead, we ask the inventors nicely if we can incorporate their work into our own project. Looking at this phenomenon from a pragmatic point of view, we can see the results of this decoupling of functionality, and code reuse, evidenced by the multitude of Web Services that are present on the Internet.
Of course, part of not reinventing the wheel each time you need to accomplish something means that communicating with legacy systems is also necessary now and then, and quite a lot of work has and is being done to ensure seamless communication between older systems and the new ones being rolled out.
The upshot of this distributed, loosely coupled architecture and design paradigm is that communication is more important than ever. Whatever the communication needs of modern systems are, it is a safe bet that somewhere along the line XML will come into play as the transport medium of choice and if that is not quite true now, it will be true soon enough.
XML is a huge topic and we don't cover it in great detail here. We assume that you have a basic knowledge of XML in order to use this chapter. And if you're not familiar with XML but would like a good grounding, you might want to take a look at Beginning XML, 3rd Edition (Wiley, ISBN 0-7645-7077-3). However, having already advocated the use of XML as a mechanism for allowing applications to communicate with one another, we spend this chapter looking at how SOAP (Simple Object Access Protocol) can be used to implement XML based communications in PHP5.