Export (0) Print
Expand All

WebServiceAttribute.Name Property

Gets or sets the name of the XML Web service.

Namespace:  System.Web.Services
Assembly:  System.Web.Services (in System.Web.Services.dll)

public string Name { get; set; }

Property Value

Type: System.String
The name for the XML Web service. Default value is the name of the class implementing the XML Web service.

The Service Description is generated when a user navigates to the URL for the XML Web service and supplies a query string of ?WSDL. Within the Service Description, the Name property identifies the local part of the XML qualified name for the XML Web service. The Name property is also used to display the name of the XML Web service on the Service help page. The Service help page is displayed when a prospective consumer navigates to the.asmx page for the XML Web service without specifying an XML Web service method name and its parameters.

An XML qualified name is used to disambiguate elements with the same name with an XML document. An XML qualified name consists of the following two parts separated by a colon: namespace or a prefix associated with a namespace and local part. The namespace consists of a URI reference and for the purposes of the Service Description, is the value of the Namespace property. In general, a prefix, which acts like an alias to an URI, is associated with the namespace, so that all subsequent XML qualified names using the namespace can use the shortened prefix. The local part is a string beginning with a letter or underscore containing no spaces. Therefore, the XML qualified name identifying a XML Web service in the Service Description is in the following format:

Namespace : Name

For more information on XML qualified names, see http://www.w3.org/TR/REC-xml-names/.

The following example sets Name of the XML Web service to MyName.


<%@ WebService Language="C#" class= "ServerVariables"%>

 using System.Web.Services;

 [ WebService(Description="Server Variables",
              Namespace="http://www.microsoft.com/",
              Name="MyName")]
 public class ServerVariables: WebService {
    [ WebMethod(Description="Returns the time as stored on the Server",
    EnableSession=false)]
    public string Time() {
       return Context.Timestamp.TimeOfDay.ToString();
    }
 }
 


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2015 Microsoft