Web Services Made Easy With Delphi
(Page 1 of 4 )
Web services are being used more and more on the Internet, thanks to (among other advantages) their cross-platform compatibility. In this article, the first of three parts, we will cover what a web service is and how it works, and look at some examples of XML and SOAP messages.
What is a web service? It is a collection of protocols that is used to exchange data between applications. To better explain what a web service is, let's take a look at an example. Say you run a music shop that has a web service. It lets customers search for the availability of a particular CD, given the name of the artist or group. To access this web service, you'll need to call its method and supply the artist or group name; in return, it gives you the particulars regarding availability of that CD.
We do this kind of thing regularly on websites with some kind of user interface. For example, with Amazon, you search for a product by entering the name of the product and you get the results listed. A web service works pretty much in the same way, with some differences.
The key difference is that a web service does not provide the user with a GUI, and enables applications to interface or communicate with each other. Software that is written in different programming languages and that run on different platforms can use web services to exchange data over computer networks such as the Internet. In other words, Windows applications can talk to Java and Perl applications (as well as others), which in normal circumstances would not be possible.
How Does a Web Service Work?
As I've stated in the introduction, web services enables communication between applications. They do this by using a combination of protocols and standards: XML, SOAP and WSDL. We are going to discuss these protocols at length before we build an example web service. Basically, a web service uses XML to tag data, SOAP to transfer a message and finally WSDL to describe the availability of services. Below is an example of a SOAP message:
<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=
"http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<fi ndCD>
<rating>JBrown</rating>
</fi ndCD>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
A web service, because of its very nature requires protocols and standards that support both platform independence and implementation independence.
Next: Why use XML (eXtensible Markup Language)? >>
More Delphi-Kylix Articles
More By Leidago