Discussion Community

IT Acumens Forum => Programming Discussions for Engineers => Web Services in PHP => Topic started by: sukishan on Jul 14, 2009, 10:48 PM

Title: Basics of Web Services
Post by: sukishan on Jul 14, 2009, 10:48 PM
The Basics of Web Services
The first thing to understand about Web Services is they're not really anything new. If you've ever used an RSS Feed to take news from another Website and place it on your own, you've already got a good idea of how Web Services work (see Kevin Yank's article: PHP and XML: Parsing RSS 1.0).

Web Services are about exchanging data between a server and a client, using a standard XML format to "package" requests and data so that both systems can "understand" each other. The server and the client could both be Web servers, or any other electronic device you care to think of.

Network-wise, data exchange in a Web Service typically happens via TCP port 80, using standard HTTP protocol POSTs. Put another way, Web Services operate in basically the same way your browser does when it POSTs an HTML form to a site, and receives a Web page in response. The only real difference is that, instead of HTML, Web Services use XML. And this means Web Services can be available anywhere on the Internet, passing through firewalls the same way viewing a Web page does. The data exchange happens at the packaging layer.

On top of the data exchange, you also need information that describes the interface (or Application Program Interface - API) to the service. This makes the Web Service useful to the rest of the Internet, allowing other developers to develop programs that can access your Web Service. This is called the description layer, and the WSDL (Web Service Description Language) standard that will make this happen is under development.

Above that, there's information that describes the nature of the service itself (not unlike the HTML-descriptive META tags), so that it can be categorised and found on sites that offer Web Service directories. This is the discovery layer, which is currently being addressed by the UDDI (Universal Description, Discovery and Integration) standard.

Both the description and discovery layers are simply XML, governed by a particular format that enables relevant information to be found for all Web Services on the Internet.

Perhaps what's made Web Services a hot topic recently -- aside from marketing by the likes of Microsoft and IBM -- is the development of these standards. They'll allow Web Services to be rolled out en masse across the Internet, backed by development tools that'll make access to them both predictable and easy.

But it should be remembered that everything a Web Service does now, in terms of data exchange, could also have been done 5 or even 10 years ago using the HTTP standard and whichever XML format you chose to use or invent (RSS feeds being a prime example). The "hot news" today is that building and distributing a Web Service is now a lot easier than in the past.