ServiceDescription 类

定义

提供一种方法,以创建和格式化用于描述 XML Web services 的有效的 Web 服务描述语言 (WSDL) 文档文件,该文件是完整的,具有适当的命名空间、元素和特性。 此类不能被继承。

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")

注解

可以使用 关键字或静态 Read 方法创建new此类的实例,该方法分析 WSDL 文件并将其值分配给类的相应成员。

WSDL 是基于 XML 的语言,用于描述 XML Web 服务。 类 ServiceDescription 对应于 WSDL 文件的根元素 definitions。 有关 WSDL 的更多信息,请参阅 WSDL 规范。

构造函数

ServiceDescription()

初始化 ServiceDescription 类的新实例。

字段

Namespace

在其中定义类的 ServiceDescription XML 命名空间 (“http://schemas.xmlsoap.org/wsdl/") 。 此字段为常数。

属性

Bindings

获取包含在 Binding 中的 ServiceDescription 元素的集合。

Documentation

获取或设置 DocumentableItem 的实例的文本文档。

(继承自 DocumentableItem)
DocumentationElement

获取或设置 DocumentableItem 的文档元素。

(继承自 DocumentableItem)
ExtensibleAttributes

获取或设置类型为 XmlAttribute 的数组,该数组表示为符合 Web 服务互操作性 (WS-I) 基本概要 1.1 而进行的 WSDL 特性扩展。

(继承自 DocumentableItem)
Extensions

获取包含在 ServiceDescription 中的扩展性元素的集合。

Imports

获取包含在 Import 中的 ServiceDescription 元素的集合。

Messages

获取包含在 Message 中的 ServiceDescription 元素的集合。

Name

获取或设置包含 Web 服务描述语言 (WSDL) 文件的标记的 XML 名称属性 descriptions

Name

获取或设置项的名称。

(继承自 NamedItem)
Namespaces

获取或设置命名空间前缀和命名空间的字典,该字典用于在构造 ServiceDescription 对象时,保留命名空间的前缀和命名空间。

(继承自 DocumentableItem)
PortTypes

获取包含在 PortType 中的 ServiceDescription 元素的集合。

RetrievalUrl

获取或设置 ServiceDescription 实例应用于的 XML Web services 的 URL。

Schema

获取与此 ServiceDescription 关联的架构。

Serializer

获取用于在 ServiceDescription 对象和 Web 服务描述语言 (WSDL) 文档之间进行序列化和反序列化的 XML 序列化程序。

ServiceDescriptions

获取 ServiceDescriptionCollection 为其成员的 ServiceDescription 实例。

Services

获取包含在 Service 中的 ServiceDescription 实例的集合。

TargetNamespace

获取或设置将 Web 服务描述语言 (WSDL) 文件括起来的 targetNamespace 标记的 XML descriptions 特性。

Types

获取或设置 Types 所包含的 ServiceDescription

ValidationWarnings

获取一个 StringCollection,其中包含在调用 Read(Stream, Boolean)Read(TextReader, Boolean)Read(String, Boolean)Read(XmlReader, Boolean) 并将 validate 参数设置为 true 的情况下生成的所有验证警告。

方法

CanRead(XmlReader)

获取一个值,该值指示 XmlReader 是否表示可分析的有效 Web 服务描述语言 (WSDL) 文件。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
Read(Stream)

通过直接从 ServiceDescription 实例加载 XML 来初始化 Stream 类的实例。

Read(Stream, Boolean)

通过直接从 ServiceDescription 实例加载 XML 来初始化 Stream 类的实例。

Read(String)

通过直接从指定的文件加载 XML 来初始化 ServiceDescription 对象的实例。

Read(String, Boolean)

通过直接从指定的文件加载 XML 来初始化 ServiceDescription 对象的实例。

Read(TextReader)

通过直接从 ServiceDescription 加载 XML 来初始化 TextReader 类的实例。

Read(TextReader, Boolean)

通过直接从 ServiceDescription 加载 XML 来初始化 TextReader 类的实例。

Read(XmlReader)

通过直接从 ServiceDescription 加载 XML 来初始化 XmlReader 类的实例。

Read(XmlReader, Boolean)

通过直接从 ServiceDescription 加载 XML 来初始化 XmlReader 类的实例。

ToString()

返回表示当前对象的字符串。

(继承自 Object)
Write(Stream)

ServiceDescription 写出到指定的 Stream

Write(String)

ServiceDescription 作为 Web 服务描述语言 (WSDL) 文件写出到指定的路径。

Write(TextWriter)

ServiceDescription 作为 Web 服务描述语言 (WSDL) 文件写出到 TextWriter

Write(XmlWriter)

ServiceDescription 作为 Web 服务描述语言 (WSDL) 文件写出到 XmlWriter

适用于