HTTP

Team-Fly    

 
XML, Web Services, and the Data Revolution
By Frank  P.  Coyle
Table of Contents
Chapter 4.   SOAP


HTTP is an important building block for using XML as a Web-based messaging protocol. Although the Internet and various protocols such as FTP and TELNET had been in existence since the 1970s for moving files, sending email, and allowing individuals to connect remotely, it wasn't until 1992 that the face of the Internet was changed through the use of a simple request-response protocol known as HTTP.

Figure 4.3 shows that HTTP works much like FTP except that the contents of a file are delivered to a browser instead of a filesystem. Add to the browser the ability to display specially designed HTML files, and we have the Web as we know it today.

Figure 4.3. Both HTTP and FTP move data across the Internet. FTP delivers data directly to disk while HTTP delivers it to a browser. When the data is in HTML or a format the browser understands, we have the Web.

graphics/04fig03.jpg

To understand how XML is used as a protocol language it is instructive to take a look at how HTTP works. The first HTTP specification written by Tim Berners-Lee is a study in simple elegance . Clients request files from servers using a simple text string of the form:

 GET filename 

This command is interpreted as a request to a server listening on port 80. The response of the server is either the contents of the requested file or a string indicating an error. Like most Web technologies, HTTP gains its power from its simplicity and its explicit avoidance of transport lock-in. HTTP sits on top of TCP/IP, which is responsible for reliably moving data between Internet nodes. Figure 4.4 illustrates the simple request-response protocol that HTTP makes possible.

Figure 4.4. HTTP, a simple request-response Web protocol, has been the catalyst for XML's widespread use. The HTTP GET command requests a Web page. The HTTP POST command delivers information and receives information back.

graphics/04fig04.jpg

The most common scenario on the Web is for the requested file to contain text and HTML tags. When text and tags are returned to a browser, the tags are interpreted according to a browser's internal programming model. The HTTP protocol says nothing about how tags are rendered, which is why different browsers often display the same Web page in very different ways. The HTTP GET command, however, allows data transfer only from server to client; to permit the transfer of data from client to server, the POST command was added.

POST Me Some Data

The POST command is a request for a server to do something with data delivered as part of the POST message. POST was included in the HTTP specification in order to deliver HTML form data to a server for processing by some server program. The structure of a POST request is similar to a GET, except that data intended for the server appears after the header and is referred to as the body or payload of the request.

Figure 4.5 illustrates the structure of an HTTP request showing the difference between GET and POST. When a POST request arrives at a server, the server looks for data following the blank line that signals the end of header information. This data delivery mechanism turns out to be the key element in moving XML across the Internet. Instead of supplying data from an HTML form, the payload slot of an HTTP request can just as easily be packaged with XML.

Figure 4.5. The structure of an HTTP request provides an opportunity for delivering XML. As far as HTTP is concerned , it's just data.

graphics/04fig05.jpg

As Figure 4.6 shows, XML's transport independence means that it may be carried by any Internet protocol, including HTTP and FTP, or even sent via mail using Simple Mail Transfer Protocol (SMTP). This freedom to move data has opened the door to XML-RPC, SOAP, and the entire Web services initiative.

Figure 4.6. XML and HTTP are loosely coupled, with no internal dependencies on each other. Distributed infrastructures such as CORBA, RMI, and DCOM are tightly coupled , with dependencies between data and transport.

graphics/04fig06.jpg


Team-Fly    
Top


XML, Web Services, and the Data Revolution
XML, Web Services, and the Data Revolution
ISBN: 0201776413
EAN: 2147483647
Year: 2002
Pages: 106
Authors: Frank Coyle

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net