There must have been plenty of times that you had wished that you could access the weather application running on Bob’s machine but you couldn’t. The reason being that you are using Windows Operating System and Bob is using Unix. There could be other times when Bob wanted to use your currency converter written in C# for his website but couldn’t do it because Bob’s client cannot talk to Windows. Well – this bottleneck is a thing of the past. Welcome to the world of web services. Using web services you can access applications running on different hardware, software, database, or even different programming language making it appear as though the application is running on your local machine. My aim of writing this blog is to make a kind of survey on the use of web services with PHP. To do that we need to first understand the nuts and bolts of web services.
Web Services can be defined as application components that communicate with each other using open protocols. Though web services may depend on a number of protocols like FTP, SMTP, XMPP etc, the basis of web services is still XML and HTPP. The reason for using XML is due to the fact that we need some language that will act as platform and programming language neutral. XML fits this requirement perfectly. The reason for choosing HTTP is because it is the most commonly used transport protocol on the Internet. So, by using XML and HTTP web services converts your application into true “web application” that can perform a predetermined function for any user requesting its service.
Before we get into examples for web services we need to understand a few more terms that are associated with web services. They are:
Formerly known as Simple Object Access Protocol, SOAP is a communication protocol for communicating between client and server over the Internet. SOAP is used instead of other protocols because it is platform and programming language independent, is based on XML and can swim across firewalls. Basically SOAP is kind of agreed standard for communication between the client and server. PHP implementation of SOAP include PEAR:SOAP,PHP-SOAP and NuSOAP.
It stands for Universal Description,Discovery and Integration, is actually a registry(or directory) for owners of web services to publish about their services. UDDI is platform independent and is based on XML. So, if you want to know about the available web services on the Internet, you may look into an UDDI registry on the Internet.
It stands for Web Servcies Description Language, is a XML based language, a machine readable description to describe a web service.
XML stands for extensible Markup Language, a data interchange format. It is designed to transport or store data using custom tags that are self descriptive.
Short form for Hypertext Transfer Protocol, HTTP is the protocol that runs the world wide web. HTTP defines how messages are defined, transmitted and how web server/web client(browser) should behave upon a specific command.
Now that we have gone through the nuts and bolts of web service,let us play with a few examples. In the next edition of this article we will discuss an example of a web service using php.
Till then happy PHPing