■
Note
Previous editions of this text included an entire chapter devoted to the topic of the .NET remoting APIs.
With the release of WCF, however, I have decided not to include this chapter in this edition. The chapter on .NET
remoting APIs (titled “The .NET Remoting Layer”) can be obtained free of charge from the Apress website
(
http://www.apress.com
) by those who have purchased this text.
The Role of XML Web Services
Each of the previous distributed APIs provided little (if any) support to allow external callers to
access the supplied functionality in an
agnostic manner. When you need to expose the services of
remote objects to
any operating system and any programming model, XML web services provide
the most straightforward way of doing so.
Unlike a traditional browser-based web application, a web service is simply a way to expose the
functionality of remote components via standard web protocols. Since the initial release of .NET,
programmers have been provided with superior support for building and consuming XML web
services via the System.Web.Services namespace. In fact, in many cases, building a feature-com-
plete web service is no more complicated than applying the [WebMethod] attribute to each public
method you wish to provide access to. Furthermore, Visual Studio 2008 allows you to connect to a
remote web service with the click of a button (or two).
Web services allow developers to build .NET assemblies containing types that can be accessed
via simple HTTP. Furthermore, a web service encodes its data as simple XML. Given the fact that
web services are based on open industry standards (HTTP, XML, SOAP, etc.) rather than proprietary
type systems and proprietary wire formats (as is the case with DCOM or .NET remoting), they allow
for a high degree of interoperability and data exchange. Figure 25-1 illustrates the agnostic nature of
XML web services.
Of course, no distributed API is perfect. One potential drawback of web services is the fact that
they can suffer from some performance issues (given the use of HTTP and XML data representa-
tion), and they may not be an ideal solution for in-house applications where a TCP-based protocol
and binary formatting of data could be used without penalty.
A .NET Web Service Example
For many years now, .NET programmers have created web services using the ASP.NET Web Service
project template of Visual Studio, which can be accessed using the File ➤ New ➤ Web Site dialog
box. This particular project template creates a commonly used directory structure and a handful of
initial files to represent the web service itself. While this project template is very helpful to get you
up and running, you are able to build a .NET XML web service using a simple text editor and test it
immediately using the ASP.NET development web server, WebDev.WebServer.exe (Chapter 31 exam-
ines this utility in more detail).
C H A P T E R 2 5
Do'stlaringiz bilan baham: |