Web Services and the .NET Framework


With the .NET Framework, it is easy to create and consume Web services. The three major namespaces that deal with Web services are:

  • The classes in the namespace System.Web.Services are used to create Web services.

  • With the namespace System.Web.Services.Description, you can describe Web services via WSDL.

  • With System.Web.Services.Protocols you can create SOAP requests and responses.

Creating a Web Service

To implement a Web service, you can derive the Web service class from System.Web.Services.WebService. The WebService class provides access to ASP.NET Application and Session objects. Using this class is optional, and you have to derive from it only if you need easy access to the properties the class offers.

WebService Property

Description

Application

Returns an HttpApplicationState object for the current request.

Context

Returns an HttpContext object that encapsulates HTTP specific information. With this context the HTTP header information can be read.

Server

Returns an HttpServerUtility object. This class has some helper methods to do URL encoding and decoding.

Session

Returns an HttpSessionState object to store some state for the client.

User

Returns a user object implementing the IPrincipal interface. With this interface, you can get the name of the user and the authentication type.

SoapVersion

Returns the SOAP version that is used with the Web service. The SOAP version is encapsulated in the enumeration SoapProtocolVersion.




Beginning Visual C# 2005
Beginning Visual C#supAND#174;/sup 2005
ISBN: B000N7ETVG
EAN: N/A
Year: 2005
Pages: 278

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