Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SoapBinding Class

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.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (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 = "http://schemas.xmlsoap.org/disco/scl/";

         // 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.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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