ServiceDescription 類別

定義

提供一種建立並格式化有效的 Web Services Description Language(WSDL)文件檔的方法,並附有適當的命名空間、元素與屬性,以描述 XML Web 服務。 此類別無法獲得繼承。

public ref class ServiceDescription sealed : System::Web::Services::Description::DocumentableItem
public ref class ServiceDescription sealed : System::Web::Services::Description::NamedItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class ServiceDescription : System.Web.Services.Description.DocumentableItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class ServiceDescription : System.Web.Services.Description.NamedItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type ServiceDescription = class
    inherit DocumentableItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type ServiceDescription = class
    inherit NamedItem
Public NotInheritable Class ServiceDescription
Inherits DocumentableItem
Public NotInheritable Class ServiceDescription
Inherits NamedItem
繼承
ServiceDescription
繼承
ServiceDescription
屬性

範例

以下範例說明如何建立該 ServiceDescription 類別的實例。

// Obtain the ServiceDescription of existing Wsdl.
ServiceDescription^ myDescription = ServiceDescription::Read( "MyWsdl_CS.wsdl" );

// Remove the Binding from the Binding Collection of ServiceDescription.
BindingCollection^ myBindingCollection = myDescription->Bindings;
myBindingCollection->Remove( myBindingCollection[ 0 ] );

// Form a new Binding.
Binding^ myBinding = gcnew Binding;
myBinding->Name = "Service1Soap";
XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" );
myBinding->Type = myXmlQualifiedName;
SoapBinding^ mySoapBinding = gcnew SoapBinding;
mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http";
mySoapBinding->Style = SoapBindingStyle::Document;
OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myDescription->TargetNamespace );
myBinding->Operations->Add( addOperationBinding );
myBinding->Extensions->Add( mySoapBinding );

// Add the Binding to the ServiceDescription.
myDescription->Bindings->Add( myBinding );
myDescription->Write( "MyOutWsdl.wsdl" );
// Obtain the ServiceDescription of existing Wsdl.
ServiceDescription myDescription = ServiceDescription.Read("MyWsdl_CS.wsdl");
// Remove the Binding from the Binding Collection of ServiceDescription.
BindingCollection myBindingCollection = myDescription.Bindings;
myBindingCollection.Remove(myBindingCollection[0]);

// Form a new Binding.
Binding myBinding = new Binding();
myBinding.Name = "Service1Soap";
XmlQualifiedName myXmlQualifiedName =
                     new XmlQualifiedName("s0:Service1Soap");
myBinding.Type = myXmlQualifiedName;

SoapBinding mySoapBinding = new SoapBinding();
mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http";
mySoapBinding.Style = SoapBindingStyle.Document;

OperationBinding addOperationBinding =
       CreateOperationBinding("Add",myDescription.TargetNamespace);
myBinding.Operations.Add(addOperationBinding);
myBinding.Extensions.Add(mySoapBinding);

// Add the Binding to the ServiceDescription.
myDescription.Bindings.Add(myBinding);
myDescription.Write("MyOutWsdl.wsdl");
' Obtain the ServiceDescription of existing Wsdl.
Dim myDescription As ServiceDescription = ServiceDescription.Read("MyWsdl_VB.wsdl")
' Remove the Binding from the Binding Collection of ServiceDescription.
Dim myBindingCollection As BindingCollection = myDescription.Bindings
myBindingCollection.Remove(myBindingCollection(0))

' Form a new Binding.
Dim myBinding As New Binding()
myBinding.Name = "Service1Soap"
Dim myXmlQualifiedName As New XmlQualifiedName("s0:Service1Soap")
myBinding.Type = myXmlQualifiedName

Dim mySoapBinding As New SoapBinding()
mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http"
mySoapBinding.Style = SoapBindingStyle.Document

Dim addOperationBinding As OperationBinding = CreateOperationBinding("Add", _
                                             myDescription.TargetNamespace)
myBinding.Operations.Add(addOperationBinding)
myBinding.Extensions.Add(mySoapBinding)

' Add the Binding to the ServiceDescription.
myDescription.Bindings.Add(myBinding)
myDescription.Write("MyOutWsdl.wsdl")

備註

此類別的實例可用關鍵字或靜態方法建立 new ,靜態 Read 方法解析 WSDL 檔案並將其值指派給類別中適當的成員。

WSDL 是一種基於 XML 的語言,用於描述 XML 網路服務。 該 ServiceDescription 類別對應於 WSDL 檔案的根元素 definitions。 欲了解更多關於 WSDL 的資訊,請參閱 WSDL 規範。

建構函式

名稱 Description
ServiceDescription()

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

欄位

名稱 Description
Namespace

定義該類別的 ServiceDescription XML 命名空間(「http://schemas.xmlsoap.org/wsdl/")。 此欄位是常數。

屬性

名稱 Description
Bindings

取得包含於 Binding的元素集合ServiceDescription

Documentation

取得或設定 實例 DocumentableItem的文字文件。

(繼承來源 DocumentableItem)
DocumentationElement

取得或設定 文件元素。DocumentableItem

(繼承來源 DocumentableItem)
ExtensibleAttributes

取得或設定一個型別 XmlAttribute 陣列,代表 WSDL 的屬性擴充,以符合 Web Services 互通性(WS-I)Basic Profile 1.1。

(繼承來源 DocumentableItem)
Extensions

取得包含於 ServiceDescription的可擴充元素集合。

Imports

取得包含於 Import的元素集合ServiceDescription

Messages

取得包含於 Message的元素集合ServiceDescription

Name

取得或設定包圍 Web Services Description Language(WSDL)檔案的標籤的 XML 名稱屬性 descriptions

Name

取得或設定物品名稱。

(繼承來源 NamedItem)
Namespaces

取得或設定命名空間前綴與命名空間的字典,用於在物件建構時 ServiceDescription 保留命名空間前綴與命名空間。

(繼承來源 DocumentableItem)
PortTypes

取得包含於 PortType的元素集合ServiceDescription

RetrievalUrl

取得或設定該實例所適用的 XML 網路服務 ServiceDescription 的 URL。

Schema

會得到與此 ServiceDescription相關聯的結構。

Serializer

取得用於在物件與 Web 服務描述語言(WSDL)文件間 ServiceDescription 序列化與反序列化的 XML 序列化器。

ServiceDescriptions

取得 ServiceDescriptionCollectionServiceDescription 成員的實例。

Services

取得包含在 中的實例集合ServiceServiceDescription

TargetNamespace

取得或設定包覆於網路服務描述語言(WSDL)檔案的標籤的 XML targetNamespace 屬性 descriptions

Types

得到或設定 被 Types 包含於 ServiceDescription

ValidationWarnings

取得 StringCollection 包含在呼叫 Read(Stream, Boolean)Read(TextReader, Boolean)Read(String, Boolean)Read(XmlReader, Boolean) 參數 validate 設為 true時產生的任何驗證警告。

方法

名稱 Description
CanRead(XmlReader)

會獲得一個值,指示 是否 XmlReader 代表可解析的有效 Web Services Description Language(WSDL)檔案。

Equals(Object)

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

(繼承來源 Object)
GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetType()

取得目前實例的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
Read(Stream, Boolean)

透過直接從實ServiceDescription例載入 XML 來初始化類別Stream的實例。

Read(Stream)

透過直接從實ServiceDescription例載入 XML 來初始化類別Stream的實例。

Read(String, Boolean)

透過直接從指定檔案載入 XML 來初始化物件實 ServiceDescription 例。

Read(String)

透過直接從指定檔案載入 XML 來初始化物件實 ServiceDescription 例。

Read(TextReader, Boolean)

透過直接從 S 載入 XML ServiceDescription來初始化該TextReader類別的實例。

Read(TextReader)

透過直接從 S 載入 XML ServiceDescription來初始化該TextReader類別的實例。

Read(XmlReader, Boolean)

透過直接從 S 載入 XML ServiceDescription來初始化類別的XmlReader實例。

Read(XmlReader)

透過直接從 S 載入 XML ServiceDescription來初始化類別的XmlReader實例。

ToString()

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

(繼承來源 Object)
Write(Stream)

將 寫 ServiceDescription 入指定的 Stream

Write(String)

ServiceDescription Web 服務描述語言(WSDL)檔案寫入指定的路徑。

Write(TextWriter)

將 寫 ServiceDescription 入 Web Services Description Language(WSDL)檔案至 TextWriter

Write(XmlWriter)

將 寫 ServiceDescriptionXmlWriter Web Services Description Language(WSDL)檔案。

適用於