Web service: Difference between revisions
imported>Pat Palmer mNo edit summary |
imported>Pat Palmer (adding to intro) |
||
Line 2: | Line 2: | ||
A '''web service''' is a broad term referring to ''client-server'' approaches to distributing software across a network. Since around 2000, the term has been used predominantly to refer to two distinct ways by which computer programs can request information from remote computers, web services with [[SOAP]] and web services with [[REST]]. | A '''web service''' is a broad term referring to ''client-server'' approaches to distributing software across a network. Since around 2000, the term has been used predominantly to refer to two distinct ways by which computer programs can request information from remote computers, web services with [[SOAP]] and web services with [[REST]]. | ||
The two approaches grew up simultaneously from different groups. Although a vitriolic and highly politicized debate about the merits of the two approaches was fought in internet blogs and articles from 2004 until 2008, the approaches are really quite different, with | The two approaches grew up simultaneously from different groups. Although a vitriolic and highly politicized debate about the merits of the two approaches was fought in internet blogs and articles from 2004 until 2008, the approaches are really quite different, and both have achieved widespread acceptance. The choice between the two may depend on a number of non-trivial and non-obvious technical factors having to do with long-term maintainability, ease of use, security or performance. | ||
SOAP-based web services publish a formally defined service contract described in a machine-processable format ([[WSDL]], a form of [[XML]]), and the SOAP protocol (riding on top of TCP) uses XML as the messaging "wire format" between client and server. For some examples, see the U. S. Geological Survey ([[USGS]]) page (see [[Web_service/External_Links|External Links]]). | SOAP-based web services publish a formally defined service contract described in a machine-processable format ([[WSDL]], a form of [[XML]]), and the SOAP protocol (riding on top of TCP) uses XML as the messaging "wire format" between client and server. For some examples, see the U. S. Geological Survey ([[USGS]]) page (see [[Web_service/External_Links|External Links]]). |
Revision as of 10:37, 22 May 2011
A web service is a broad term referring to client-server approaches to distributing software across a network. Since around 2000, the term has been used predominantly to refer to two distinct ways by which computer programs can request information from remote computers, web services with SOAP and web services with REST. The two approaches grew up simultaneously from different groups. Although a vitriolic and highly politicized debate about the merits of the two approaches was fought in internet blogs and articles from 2004 until 2008, the approaches are really quite different, and both have achieved widespread acceptance. The choice between the two may depend on a number of non-trivial and non-obvious technical factors having to do with long-term maintainability, ease of use, security or performance.
SOAP-based web services publish a formally defined service contract described in a machine-processable format (WSDL, a form of XML), and the SOAP protocol (riding on top of TCP) uses XML as the messaging "wire format" between client and server. For some examples, see the U. S. Geological Survey (USGS) page (see External Links).
REST-based web services use TCP. The request "wire format" is a TCP GET command, parameters are appended to the URL, returned data can be in a variety of text-based formats, and there is no standard for formally publishing a service contract. A well-known example of the REST web service is the Google Maps API (see External Links).
History
As soon as there were programming languages, computer programmers have desired to reuse certain programs to avoid "reinventing the wheel". One of the ways people envisioned reusing software was to provide libraries of code which could be called by other programmers. Ever since the advent of the internet, programmers sought ways to call the code in libraries from remote host computers. But such remote calling was difficult because there were many different types of computer hardware and operating systems, each of which stored and processed data in very different ways.
In the 1980's, people used the C programming language to make Remote Procedure Calls from one computer to another across the internet. But such RPC programming, or "sockets programming" as it was sometimes called, was cumbersome and difficult to achieve. And it was especially difficult when the two endpoints of the connection were on different hardware or operating systems.
A second, related goal was to achieve electronic commerce. People desired to place orders on their local computer have the orders transmitted electronically to remote computers, perhaps located in different companies, for fulfillment. This led to an effort called Electronic Data Interchange (EDI), which attempted to define messaging CORfor such exchanges of orders. The messaging style used in the 1980's was ASN.1 (Abstract Syntax Notation), which was complex and difficult to work with.
In the 1990's, Microsoft Windows introduced new technologies for creating remotely callable libraries across a network. COM, COM+, and DCOM were successive generations of the Microsoft technology, and these kinds of remote libraries could be created and deployed rapidly if both endpoint computers were running Microsoft Windows. In response to the growing success of COM on Windows, the UNIX world (led by Sun Microsystems) created a consortium, Open Management Group (OMG), that defined CORBA as a remote calling technology for UNIX and Linux. CORBA and COM competed heavily throughout the 1990's.
Then in 1998, the XML standard emerged. XML messages, which consist of only plain text (no binary strings), are not blocked by firewalls. Also, all the leading programming languages and operating systems quickly developed software tools to parse XML. So XML became the new way to package information for shipping across a network.
In 2000, Microsoft began quietly leading an industry consortium to define a standardized way of using XML for messaging in remote procedure calls. This consortium resulted in the SOAP standard. SOAP is a special form of XML that can be used for RPC's. When a called on a local computer wished to invoke a library on a remote computer, the name of the procedure being called and any parameters for the call must be "serialized" into a SOAP message. The SOAP (XML) message is shipped across the network to the library, which "deserializes" the SOAP message, executes the call, prepares the results, and then "serializes" the results into SOAP. The SOAP result is shipped back across the network to the caller, where it is then "deserialized".
With the .NET platform in 2002, Microsoft introduced early implementation of several standards related to using SOAP messaging in remote procedure calls. Most importantly, Microsoft provided automation for creating proxy objects. Proxies are procedures that seem to be on the local computer, and programmers call them just as if there were local. But in reality, when a proxy is called, it serializes the request and sends it to a remote computer, awaits the response and deserializes it, and then responds to the caller. The caller need not even be aware that a remote call is being made.
Key to proxy automation is that each remote procedure's "contract" is first published permanently on the web as an XML document. The standard for describing how to call a SOAP-based remote procedure is WSDL (Web Services Description Language). Microsoft's Visual Studio .NET, beginning in 2002, allowed programmers to create procedures and annotate them with a "WebMethod" attribute. The presence of this attribute meant that the .NET compiler would automatically create the WSDL document for the programmer. Thus it was very easy to create a callable SOAP-based web service. Likewise, Visual Studio .NET automated the creation of a proxy on the client side; calling a SOAP-based web service required only that the programmer add a "web reference" in her project, by giving Visual Studio the URL of the WSDL document describing the procedure to be called. After that, the remote procedure (a so-called SOAP-based web service) could be invoked as if it were local.
No sooner had programmers begun extensively using SOAP-based web services, than what appeared to be an alternative was proposed, so-called REST-based web services. Since 2000, a vigorous and often impolite debate has been waged among developers on the internet, full of zealotry for each technology. As with any competing technologies, there are good reasons to use either one in certain circumstances.