In the previous solution, you learned to build and use XML-RPC Web services with PHP. Most of the publicly-available Web services out there, however, use the newer Simple Object Access Protocol[45] (SOAP), not XML-RPC. In thissolution, I’ll show you how to consume SOAP Web services with your PHP
scripts.
As I mentioned in the last chapter, SOAP has a supporting technology called Web Services Description Language[46] (WSDL), which is one of the main reasons SOAP has an edge over XML-RPC. WSDL is a specification that allows an XML-based messaging protocol like SOAP to be described in a manner that relates directly to the object oriented paradigm. In practical terms, all this means is that you can generate a client to a Web service on the fly if necessary, simply by reading the associated WSDL document.
It’s beyond the scope of this book to provide an in-depth analysis of how SOAP and WSDL work, but if you’ll take my word that you really don’t need to know much about these technologies to take advantage of them, I’ll use the CapeScience GlobalWeather service[49] to show you how easy it is.
scripts.
As I mentioned in the last chapter, SOAP has a supporting technology called Web Services Description Language[46] (WSDL), which is one of the main reasons SOAP has an edge over XML-RPC. WSDL is a specification that allows an XML-based messaging protocol like SOAP to be described in a manner that relates directly to the object oriented paradigm. In practical terms, all this means is that you can generate a client to a Web service on the fly if necessary, simply by reading the associated WSDL document.
It’s beyond the scope of this book to provide an in-depth analysis of how SOAP and WSDL work, but if you’ll take my word that you really don’t need to know much about these technologies to take advantage of them, I’ll use the CapeScience GlobalWeather service[49] to show you how easy it is.