WebServiceAttribute.Namespace Property

Gets or sets the default XML namespace to use for the XML Web service.

Namespace: System.Web.Services
Assembly: System.Web.Services (in system.web.services.dll)

public:
property String^ Namespace {
	String^ get ();
	void set (String^ value);
}
/** @property */
public String get_Namespace ()

/** @property */
public void set_Namespace (String value)

public function get Namespace () : String

public function set Namespace (value : String)

Not applicable.

Property Value

The default XML namespace to use for the XML Web service. The default is specified in the DefaultNamespace property.

XML namespaces offer a way to create names in an XML document that are identified by a Uniform Resource Identifier (URI). By using XML namespaces you can uniquely identify elements or attributes in a XML document. The service description for a XML Web service is defined in XML, specifically in Web Services Description Language (WSDL).

Within the Service Description for an XML Web service, Namespace is used as the default namespace for XML elements directly pertaining to the XML Web service. For example, the name of the XML Web service and its XML Web service methods pertain to the namespace specified in the Namespace property. Elements that are specific to WSDL pertain to the http://schemas.xmlsoap.org/wsdl/ namespace.

For XML Web service clients using SOAP to call an XML Web service, you can optionally add the SoapDocumentMethodAttribute or SoapRpcMethodAttribute to call an XML Web service method. If the client is calling an XML Web service created using ASP.NET, the RequestNamespace, ResponseNamespace and Action properties are all derived from the Namespace property by default. For instance, given an XML Web service method name of Time and a Namespace property of http://www.contoso.com/, the Action property is http://www.contoso.com/Time by default. To change the default settings for RequestNamespace, ResponseNamespace, and Action for an XML Web service method, you can add a SoapDocumentMethodAttribute to the XML Web service method.

NoteNote:

An XML namespace is different from the namespace the class resides in, in terms of the .NET Framework SDK. To specify the namespace for the class, see Namespace Keywords (C# Programmers Reference) if you writing in C#.

The following example sets Namespace to http://www.contoso.com and overrides that namespace for the Action property by adding a SoapDocumentMethodAttribute to the Time XML Web service method.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: