WebServiceAttribute

WebServiceAttribute

System.Web.Services (system.web.services.dll)sealed class

This attribute is not required to create a web service, but it should be used before a web service is deployed to specify a unique XML namespace and allow clients to distinguish your web service from others on the Web. By default, if you do not use this attribute, the default namespace http://tempuri.org/ is used. Namespaces look like URLs, but they do not actually need to correspond to valid locations on the Web. In a web service, the XML namespace is used to uniquely identify parts of the Service Description (WSDL) file that specifically pertain to the web service. The Name property identifies the local portion of the XML qualified name, which will be the web service class name by default. Elements of the WSDL contract that are specific to WSDL use the http://schemas.xmlsoap.org/wsdl/ namespace.

Ideally, you should use a namespace that you control, such as your company's web site address. This XML namespace should not be confused with the .NET namespace used programmatically by clients. For more information on XML qualified names, see http://www.w3.org/TR/REC-xml-names.

You can also set a Description property, which contains information about your web service that will be displayed in automatically generated description documents and the Internet Explorer test page.

public sealed class WebServiceAttribute : Attribute {
// Public Constructors
   public WebServiceAttribute( );
// Public Static Fields
   public const string DefaultNamespace;            // =http://tempuri.org/
// Public Instance Properties
   public string Description{set; get; }
   public string Name{set; get; }
   public string Namespace{set; get; }
}

Hierarchy

System.Object System.Attribute WebServiceAttribute

Valid On

Class



    Part I: Introduction to ASP.NET
    Part III: Namespace Reference
    Chapter 40. The System.Web.UI.MobileControls Namespace
    Chapter 42. The System.Web.UI.WebControls Namespace