The Web Services Advisor
An inside look at how XML works
In my previous column, I explained the underlying architecture of how Web services work and demystified how all...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
of its underlying components work together. This column kicks off a series looking at how each of those elements work. We'll start off the series by examining the basis of all Web services -- eXtensible Markup Language, or XML.
How the magic works
Let's begin with a brief refresher of what XML does. It describes a Web service in detail so that other programs can understand what that service is and know how to connect to it.
How does XML do its magic? To understand that you need to understand the nature of XML. As its name implies, XML is a markup language. But it's a very different markup language than HTML. HTML tells a browser how to display information. So when the tag <B> is used in HTML, for example, it tells a browser to display the text that follows as boldfaced text.
XML, on the other hand, doesn't tell a browser - or any other piece of software for that matter - how to display information. Rather, it is a way to structure information so that it can be easily extracted and used by other applications. Like HTML, it uses tags, but it uses them as a way to structure information rather than display it. And unlike HTML, it allows businesses and others to create their own tags to structure information.
All this sounds rather abstract, so let's take an example. Let's say that you have CDs for sale, and you'd like business partners to be able to easily get information about your stock, so that they can order from you. You and they decide to use XML as the best solution. Together, you come up with a set of tags that you agree upon - tags that give information about each of your CDs. So you put together an XML document that includes all the CDs you have for sale. Here's what part of the XML document might look like:
<CD TITLE>Kind of Blue</CD TITLE>
<CD ARTIST>Miles Davis</CD ARTIST>
<CD CATEGORY>Jazz</CD CATEGORY>
<CD PRICE>$11.98</CD PRICE>
There are a lot more tags you agree upon, such as those that define individual tracks on each CD, as well as the publisher, the names of every artist on the CD and so on. This will allow your business partners to easily parse all your information, and automatically get all the data about what you have for sale. The information can be gotten in any number of ways. You can post an XML document and an automated agent can examine it and grab information from it; you can send the XML document, and a program on the receiver's end can parse it; or you can use it as the basis for creating a Web service.
So XML allows businesses -- or anyone else, for that matter -- to create their own private rules that determine how data can be presented. But it also allows for entire subsets of the language to be created. For example, XML forms the basis of the Resource Description Framework (RDF), an XML format for describing data about things such as music playlists, photo collections, and bibliographies. And an important variant of XML is ebXML (Electronic Business XML), which uses XML to standardize how business data can be exchanged in a secure manner. Many people believe that ebXML will replace Electronic Data Interchange (EDI) as a way of transacting business electronically.
By the way, at whatever point you begin using XML, keep in mind that unlike HTML it's a very unforgiving language. If you make a mistake coding HTML, the browser tries its best to interpret your instructions, and generally either displays its best guess at what you wanted to do, or ignores your tag. With XML, the application doing the parsing will simply stop at the point there's an error and display an error message.
How does it relate to Web services?
So how does all this relate to Web services?
Remember, a Web service is a software module delivered over the Web - and in order for that module to be located and used, it needs to be described, including all the details necessary for the Web service to be accessed, including its location, transport protocols and message formats it uses. This description is called a service descriptor.
XML is used to create that service descriptor -- it describes all the information needed for the Web service to be accessed. The descriptor is built using the Web Services Description Language (WSDL), which a specialized implementation of XML for Web services. As for how WSDL works -- that's what we'll cover in my next column.
About the Author
Preston Gralla, a well-known technology expert, is the author of more than 20 books, including "How the Internet Works," which has been translated into 14 languages and sold several hundred thousand copies worldwide. He is an expert on Web services and the author of a major research and white paper for the Software and Information Industry Association on the topic. Gralla was the founding managing editor of PC Week, a founding editor and then editor and editorial director of PC/Computing, and an executive editor for ZDNet and CNet. He has written about technology for more than 15 years for many major magazines and newspapers, including PC Magazine, Computerworld, CIO Magazine, eWeek and its forerunner PC Week, PC/Computing, the Los Angeles Times, USA Today, and the Dallas Morning News among others. As a well-known technology guru, he appears frequently on TV and radio shows and networks, including CNN, MSNBC, ABC World News Now, the CBS Early Show, PBS's All Things Considered and others. He has won a number of awards for his writing, including from the Computer Press Association for the Best Feature in a Computer Publication. He can be reached at firstname.lastname@example.org.
- What do you think about this column? If you'd like to send feedback, you can E-mail the Editor.
- Visit our Best Web Links for Web Services for the best editor-selected resources on the Web.
- Post your questions or opinions, or help out your peers by answering questions, in our Discussion Forums.
- Ask the Experts! Our Web Services, SOAP, WSDL, XML, .NET, Java, and EAI gurus answer your toughest questions.