SoapBinding Classe

Définition

Représente une liaison SOAP dans un document de découverte. Cette classe ne peut pas être héritée.

public ref class SoapBinding sealed
public sealed class SoapBinding
type SoapBinding = class
Public NotInheritable Class SoapBinding
Héritage
SoapBinding

Exemples

#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 = "http://localhost/dataservice.disco";
      
      // Call the Discover method to populate the Documents property.
      DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol;
      myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials;
      DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myStringUrl );
      Console::WriteLine( "Demonstrating the Discovery::SoapBinding class." );
      
      // Create a SOAP binding.
      SoapBinding^ mySoapBinding = gcnew 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 = gcnew 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 SOAP binding.
      Console::WriteLine( "Namespace associated with the SOAP binding is: {0}", SoapBinding::Namespace );
      
      // Write all the information of the DiscoveryClientProtocol.
      myDiscoveryClientProtocol->WriteAll( ".", "results.discomap" );
      
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( e );
   }

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

class DiscoverySoapBindingClass
{
   static void Main()
   {
      Run();
   }

   [PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")]
   static void Run()
   {
      try
      {
         // '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 =
             CredentialCache.DefaultCredentials;
         DiscoveryDocument myDiscoveryDocument =
             myDiscoveryClientProtocol.Discover(myStringUrl);

         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",
             "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("Namespace associated with the SOAP binding is: "
             + SoapBinding.Namespace);

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

      }
      catch (Exception e)
      {

         Console.WriteLine(e.ToString());
      }
   }
}
Imports System.Net
Imports System.Security.Permissions
Imports System.Xml
Imports System.Web.Services.Discovery

Class DiscoverySoapBindingMod

   Shared Sub Main()
      Run()
   End Sub

   <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
End Class

Remarques

Une liaison SOAP est similaire à une interface pour les services Web XML. Il est utile pour le contrôle de version et quand vous recherchez un service web XML implémentant une liaison SOAP spécifique. Par instance, un document de découverte peut contenir des informations facultatives sur les liaisons SOAP, qui spécifient les liaisons SOAP implémentées par les services web référencés. Les liaisons SOAP sont spécifiées dans le document XML contenu dans un document de découverte en ajoutant un SOAP élément XML avec un espace de noms XML égal à la Namespace constante. La Address propriété spécifie l’URL du service Web XML et la propriété spécifie la Binding liaison SOAP implémentée par ce service Web XML.

Constructeurs

SoapBinding()

Initialise une nouvelle instance de la classe SoapBinding.

Champs

Namespace

Espace de noms XML de l'élément qui spécifie une liaison SOAP dans un document de découverte.

Propriétés

Address

Obtient ou définit l'URL du service Web XML implémentant la liaison SOAP.

Binding

Obtient ou définit le nom qualifié XML de la liaison SOAP implémentée par le service Web XML.

Méthodes

Equals(Object)

Détermine si l'objet spécifié est égal à l'objet actuel.

(Hérité de Object)
GetHashCode()

Fait office de fonction de hachage par défaut.

(Hérité de Object)
GetType()

Obtient le Type de l'instance actuelle.

(Hérité de Object)
MemberwiseClone()

Crée une copie superficielle du Object actuel.

(Hérité de Object)
ToString()

Retourne une chaîne qui représente l'objet actuel.

(Hérité de Object)

S’applique à