共用方式為


SoapBinding 類別

定義

表示探索 (Discovery) 文件中的 SOAP 繫結。 此類別無法獲得繼承。

public ref class SoapBinding sealed
public sealed class SoapBinding
type SoapBinding = class
Public NotInheritable Class SoapBinding
繼承
SoapBinding

範例

#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

備註

SOAP 系結類似于 XML Web 服務的介面。 它適用于版本控制,以及當您尋找實作特定 SOAP 系結的 XML Web 服務時。 例如,探索檔可能包含 SOAP 系結的選擇性資訊,以指定由參考 Web 服務實作的 SOAP 系結。 SOAP 系結是在探索檔內所包含的 XML 檔中指定,方法是新增 SOAP XML 命名空間等於常數的 Namespace XML 專案。 屬性 Address 會指定 XML Web 服務的 URL,而 Binding 屬性會指定該 XML Web 服務所實作的 SOAP 系結。

建構函式

SoapBinding()

初始化 SoapBinding 類別的新執行個體。

欄位

Namespace

指定探索文件中 SOAP 繫結之項目的 XML 命名空間。

屬性

Address

取得或設定實作 SOAP 繫結之 XML Web Service 的 URL。

Binding

取得或設定 XML Web Service 所實作之 SOAP 繫結的 XML 限定名稱 (Qualified Name)。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於