System.Web.Services.WebService Class

Defines the optional base class for XML Web services, which provides direct access to common ASP.NET objects, such as application and session state.

See Also: WebService Members


public class WebService : System.ComponentModel.MarshalByValueComponent


If you don't need access to the common ASP.NET objects, you can still create an XML Web service without deriving from System.Web.Services.WebService. Additional ASP.NET objects can be accessed through WebService.Context.

XML Web service methods that have the System.Web.Services.Protocols.SoapRpcMethodAttribute.OneWay property of either System.Web.Services.Protocols.SoapRpcMethodAttribute or System.Web.Services.Protocols.SoapDocumentMethodAttribute set to true, do not have access to their System.Web.HttpContext. As such, accessing any of the properties of the System.Web.Services.WebService class, from within that XML Web service method, return null.

If you are using the .NET Framework version 1.0 XML Web service methods that have either the System.Web.Services.Protocols.SoapRpcMethodAttribute or System.Web.Services.Protocols.SoapDocumentMethodAttribute attribute applied to them with the System.Web.Services.Protocols.SoapDocumentMethodAttribute.OneWay property of set to true, do not have access to their System.Web.HttpContext using the static System.Web.HttpContext.Current property. To access the System.Web.HttpContext, derive the class implementing the XML Web service method from System.Web.Services.WebService and access the WebService.Context property.


Namespace: System.Web.Services
Assembly: System.Web.Services (in System.Web.Services.dll)
Assembly Versions: 1.0.5000.0,