ServiceDescription 类

定义

提供一种创建和格式化有效的 Web 服务描述语言(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 Web 服务。 该 ServiceDescription 类对应于 WSDL 文件的根元素 definitions。 有关 WSDL 的详细信息,请参阅 WSDL 规范。

构造函数

名称 说明
ServiceDescription()

初始化 ServiceDescription 类的新实例。

字段

名称 说明
Namespace

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

属性

名称 说明
Bindings

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

Documentation

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

(继承自 DocumentableItem)
DocumentationElement

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

(继承自 DocumentableItem)
ExtensibleAttributes

获取或设置一个类型 XmlAttribute 数组,该数组表示 WSDL 的属性扩展,以符合 Web 服务互操作性(WS-I) 基本配置文件 1.1。

(继承自 DocumentableItem)
Extensions

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

Imports

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

Messages

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

Name

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

Name

获取或设置项的名称。

(继承自 NamedItem)
Namespaces

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

(继承自 DocumentableItem)
PortTypes

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

RetrievalUrl

获取或设置实例应用到的 XML Web 服务的 ServiceDescription URL。

Schema

获取与此 ServiceDescription关联的架构。

Serializer

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

ServiceDescriptions

ServiceDescriptionCollection获取成员所属的ServiceDescription实例。

Services

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

TargetNamespace

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

Types

获取或设置 TypesServiceDescription..

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, Boolean)

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

Read(Stream)

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

Read(String, Boolean)

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

Read(String)

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

Read(TextReader, Boolean)

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

Read(TextReader)

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

Read(XmlReader, Boolean)

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

Read(XmlReader)

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

ToString()

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

(继承自 Object)
Write(Stream)

将写入 ServiceDescription 指定的 Stream

Write(String)

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

Write(TextWriter)

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

Write(XmlWriter)

将作为 Web 服务描述语言(WSDL)文件写出ServiceDescriptionXmlWriter

适用于