Web service

From Citizendium
Revision as of 19:54, 3 December 2008 by imported>Pat Palmer
Jump to navigation Jump to search

Web service is a broad term encompassing a variety of ways of obtaining information over the internet. Since Microsoft's .NET platform became available in 2002, the term has been used predominantly to refer to two distinct methods by which computer programs can request information from remote computers. These methods are Web services with SOAP and Web services with REST.

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.