ASP.NET Platform Services

The ASP.NET platform provides a rich set of services for all types of Web applications. You can harness many of these features in your XML Web services just by deriving your XML Web service class from System.Web.Service.WebService.

 <WebService(Namespace:="http://www.prosetech.com/", _  Description:="Methods to interact with the Customers table.")> _ Public Class CustomerDB     Inherits WebService 

By inheriting from WebService, your class gains four additional properties, as shown in Table 5-4. These features include a few heavyweights, such as authentication and caching, that we'll return to in later chapters. These prebuilt features are so useful that in many situations you'll find it easier to build a large-scale performance-optimal solution with XML Web services rather than .NET Remoting, even though .NET Remoting supports leaner binary communication.

Table 5-4. WebService Properties

Property

Description

Application

Provides a global collection where you can store any .NET object.

Context

Provides access to some ASP.NET intrinsic objects, such as Request and Response. Most of these aren't useful in XML Web services because you are interacting with a proxy class, not directly with the client. However, one object (Cache) is extremely useful for storing frequently used information. You'll learn how to master this object in Chapter 12.

Server

Provides server utility methods for tasks such as encoding HTML content and URL query strings. These features generally aren't useful in an XML Web service.

Session

Provides a collection where you can store information that's bound to the current request. However, this capability can easily waste server memory and is disabled by default.

User

Enables you to retrieve information about the client if it has logged on through the proxy class using some form of integrated IIS authentication. You'll learn about this option and some more flexible alternatives in Chapter 13.

You could also access these properties without deriving from WebService, by using the System.Web.HttpContext class.

SOAP Headers and SOAP Extensions

SOAP headers and extensions are great ways to extend the SOAP standard, and they add support for custom encryption, logging, compression, and authentication schemes. SOAP headers and extensions are also potential nightmares because they represent proprietary add-ons that you can apply to your XML Web services, potentially making them less generic and more difficult to support on other platforms. SOAP headers and extensions are also wedded to the SOAP standard, meaning you can't easily adapt a SOAP header authentication technique or SOAP extension logging approach to a .NET Remoting component that works over a TCP/IP channel with binary messages.

This chapter won't discuss SOAP headers and extensions. However, Chapter 13 and Chapter 18 show how you can use SOAP headers to implement security in conjunction with a custom ticket-based authentication system.

Note

Microsoft is also developing a number of XML Web service extensions based on emerging SOAP standards, particularly those related to security and authentication. These are known collectively as the Web Service Enhancements (WSE) and are available at http://msdn.microsoft.com/webservices/building/wse. As these standards continue to evolve, the WSE will likely change or be incorporated into a future release of the .NET platform.




Microsoft. NET Distributed Applications(c) Integrating XML Web Services and. NET Remoting
MicrosoftВ® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting (Pro-Developer)
ISBN: 0735619336
EAN: 2147483647
Year: 2005
Pages: 174

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