This documentation is archived and is not being maintained.

SoapBinding Class

Represents a SOAP binding in a discovery document. This class cannot be inherited.


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

public sealed class SoapBinding

The SoapBinding type exposes the following members.

Public methodSoapBindingInitializes a new instance of the SoapBinding class.

Public propertyAddressGets or sets the URL of the XML Web service implementing the SOAP binding.
Public propertyBindingGets or sets the XML qualified name of the SOAP binding implemented by the XML Web service.

Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public fieldStatic memberNamespaceThe XML namespace of the element that specifies a SOAP binding within a discovery document.

A SOAP binding is similar to an interface for XML Web services. It is useful for versioning and when you look for a XML Web service implementing a specific SOAP binding. For instance, a discovery document might contain optional information about SOAP bindings, which specify the SOAP bindings implemented by referenced Web Servcies. SOAP bindings are specified within the XML document containd within a discovery document by adding a SOAP XML element with an XML namespace equal to the Namespace constant. The Address property specifies the URL of the XML Web service and the Binding property specifies the SOAP binding implemented by that XML Web service.

using System;
using System.Net;
using System.Security.Permissions;
using System.Xml;
using System.Web.Services.Discovery;

class DiscoverySoapBindingClass
   static void Main()

   [PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")]
   static void Run()
         // 'dataservice.disco' is a sample discovery document.
         string myStringUrl = "http://localhost/dataservice.disco";

         // Call the Discover method to populate the Documents property.
         DiscoveryClientProtocol myDiscoveryClientProtocol = 
             new DiscoveryClientProtocol();
         myDiscoveryClientProtocol.Credentials = 
         DiscoveryDocument myDiscoveryDocument = 

         Console.WriteLine("Demonstrating the Discovery.SoapBinding class.");

         // Create a SOAP binding.
         SoapBinding mySoapBinding = new SoapBinding();

         // Assign an address to the created SOAP binding.
         mySoapBinding.Address = "";

         // Bind the created SOAP binding with a new XmlQualifiedName.
         mySoapBinding.Binding = new XmlQualifiedName("string",

         // Add the created SOAP binding to the DiscoveryClientProtocol.

         // Display the namespace associated with SOAP binding.
         Console.WriteLine("Namespace associated with the SOAP binding is: " 
             + SoapBinding.Namespace);

         // Write all the information of the DiscoveryClientProtocol. 

      catch (Exception e)



.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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.