ServiceDescription 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供一种方法,以创建和格式化用于描述 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 类的实例。
// 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/") 。 此字段为常数。 |