Introduction to Web Services


Ever since the early days of client/server applications, applications have benefited from separation of tiers, whether that separation was physical or logical. Applications could communicate with databases that were in remote locations, or using technologies like DCOM, they could communicate with remotely located business logic.

Ever since its creation, the web has been an incredibly powerful tool for disseminating information and content. However, due to the nature of HTML, it has been difficult to use the web to disseminate data in formats that can be easily consumed by client applications.

When powerful new server-side programming technologies became available, such as Active Server Pages, Java, Perl, CGI, and more, developers began creating their own custom solutions to use the web to expose data in a consumable format.

This eventually led to the development of web pages that rendered raw XML that could then be consumed by clients. That led to the development of a standard dialect of XML that defined the contract by which a web service and its client would agree: WSDL (Web Services Description Language).

Using WSDL, modern programming languages could obtain information about functionality exposed over HTTP using web services and then consume that functionality. This provided developers with a whole new model of development that allowed them to expose discrete units of functionality on the Internet and consume it in any language on any platform so long as both the client and server could read and generate XML.

ASP.NET has provided built-in support for web services since its original release. That support has only gotten better in recent versions and will undoubtedly see even more advancements in upcoming releases.

How Web Services Work

Web services describe the methods they expose, including their parameters and return types, in an XML dialect called the Web Services Description Language (WSDL). This language provides a platform-independent description of functionality that can be consumed by any language on any platform that can interpret XML.

Using the information contained in the WSDL document, the functionality can be consumed. In the .NET world, this means that a wrapper class is created around the WSDL exposed by a web service to provide object-oriented access to the underlying web service.

When a method is invoked, it can either be invoked using an HTTP POST statement with simple parameters or it can be invoked by submitting a SOAP (Simple Object Access Protocol) envelope to the ASP.NET web service (represented by a .asmx file on the server). SOAP provides a wire format that can be used to encode method execution requests as well as return values from executed methods. The contents of the POST request or the SOAP envelope are then processed and the requested method is then executed on the server. The return value and any output parameters of that method are then encoded into output that is then sent to the client. A high-level diagram of this process is shown in Figure 32.1.

Figure 32.1. Two-step process to consume a web service.




Microsoft Visual C# 2005 Unleashed
Microsoft Visual C# 2005 Unleashed
ISBN: 0672327767
EAN: 2147483647
Year: 2004
Pages: 298

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