Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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)
'Declaration
Public NotInheritable Class SoapBinding
'Usage
Dim instance As SoapBinding

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.

Imports System
Imports System.Net
Imports System.Security.Permissions
Imports System.Xml
Imports System.Web.Services.Discovery

Class DiscoverySoapBindingMod

   Shared Sub Main()
      Run()
   End Sub 'Main

   <PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
   Shared Sub Run()

      Try 


         ' 'dataservice.disco' is a sample discovery document. 
         Dim myStringUrl As String = "http://localhost/dataservice.disco" 

         ' Call the Discover method to populate the Documents property. 
         Dim myDiscoveryClientProtocol As DiscoveryClientProtocol = _
             New DiscoveryClientProtocol()
         myDiscoveryClientProtocol.Credentials = _
             CredentialCache.DefaultCredentials
         Dim myDiscoveryDocument As DiscoveryDocument = _
             myDiscoveryClientProtocol.Discover(myStringUrl)

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

         ' Create a SOAP binding. 
         Dim mySoapBinding As SoapBinding = New SoapBinding()

         ' Assign the address to the SOAP binding.
         mySoapBinding.Address = "http://schemas.xmlsoap.org/disco/scl/" 

         ' Bind the created SOAP binding with a new XmlQualifiedName.
         mySoapBinding.Binding = New XmlQualifiedName("string", _
             "http://www.w3.org/2001/XMLSchema")

         ' Add the created SOAP binding to the DiscoveryClientProtocol.
         myDiscoveryClientProtocol.AdditionalInformation.Add(mySoapBinding)

         ' Display the namespace associated with the SOAP binding.
         Console.WriteLine("Namespace associated with Soap Binding is: " _
             + SoapBinding.Namespace)

         ' Write all the information of the DiscoveryClientProtocol. 
         myDiscoveryClientProtocol.WriteAll(".","results.discomap")


      Catch e As Exception
         Console.WriteLine(e.ToString)
      End Try 

   End Sub 'Run
End Class
#using <mscorlib.dll>
#using <System.dll>
#using <System.Xml.dll>
#using <System.Web.Services.dll>
using namespace System;
using namespace System::Net;
using namespace System::Xml;
using namespace System::Web::Services::Discovery;

int main() {
   try {
      // 'dataservice.disco' is a sample discovery document.
      String* myStringUrl = S"http://localhost/dataservice.disco";

      // Call the Discover method to populate the Documents property.
      DiscoveryClientProtocol* myDiscoveryClientProtocol = 
         new DiscoveryClientProtocol();
      myDiscoveryClientProtocol->Credentials =
         CredentialCache::DefaultCredentials;
      DiscoveryDocument* myDiscoveryDocument =
         myDiscoveryClientProtocol->Discover(myStringUrl);

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

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

      // Assign an address to the created SOAP binding.
      mySoapBinding->Address = S"http://schemas.xmlsoap.org/disco/scl/";

      // Bind the created SOAP binding with a new XmlQualifiedName.
      mySoapBinding->Binding = new XmlQualifiedName(S"String*",
         S"http://www.w3.org/2001/XMLSchema");

      // Add the created SOAP binding to the DiscoveryClientProtocol.
      myDiscoveryClientProtocol->AdditionalInformation->Add(mySoapBinding);

      // Display the namespace associated with SOAP binding.
      Console::WriteLine(S"Namespace associated with the SOAP binding is: {0}", 
         SoapBinding::Namespace);

      // Write all the information of the DiscoveryClientProtocol.
      myDiscoveryClientProtocol->WriteAll(S".", S"results.discomap");

   } catch (Exception* e) {
      Console::WriteLine(e);
   }
}
System.Object
  System.Web.Services.Discovery.SoapBinding
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

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

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.