This documentation is archived and is not being maintained.

WebServiceBindingAttribute.Namespace Property

Gets or sets the namespace associated with the binding.

[Visual Basic]
Public Property Namespace As String
[C#]
public string Namespace {get; set;}
[C++]
public: __property String* get_Namespace();
public: __property void set_Namespace(String*);
[JScript]
public function get Namespace() : String;
public function set Namespace(String);

Property Value

The namespace for the binding. The default is http://tempuri.org/.

Example

[Visual Basic, C#] The following example specifies a binding named LocalBindingNonDefaultNamespace that is a member of the http://www.contoso.com/MyBinding namespace and defined in the BindingSample XML Web service.

[Visual Basic] 
' Binding is defined in this XML Web service, but it is not a part of the default namespace.
<WebServiceBinding(Name := "LocalBindingNonDefaultNamespace", _
    Namespace := "http://www.contoso.com/MyBinding")> _
Public Class BindingSample   
    
    <SoapDocumentMethod(Binding := "LocalBindingNonDefaultNamespace"), _
        WebMethod()> _
    Public Function LocalBindingNonDefaultNamespaceMethod() As String
        
        Return "Member of binding defined in this XML Web service, but a part " & _
               "of a different namespace"
    End Function
End Class
 

[C#] 
// Binding is defined in this XML Web service, but it is not a part of the default namespace.
 [ WebServiceBinding(Name="LocalBindingNonDefaultNamespace",
 Namespace="http://www.contoso.com/MyBinding")]
 public class BindingSample  {

      [ SoapDocumentMethod(Binding="LocalBindingNonDefaultNamespace")] 
      [ WebMethod() ]
      public string LocalBindingNonDefaultNamespaceMethod() {
              return "Member of binding defined in this XML Web service, but a part of a different namespace";
      }
 }
 

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

WebServiceBindingAttribute Class | WebServiceBindingAttribute Members | System.Web.Services Namespace

Show: