SoapHeaderBinding 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示添加到 XML Web services 中的 InputBinding 或 OutputBinding 的扩展性元素。
public ref class SoapHeaderBinding : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtension("header", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))]
public class SoapHeaderBinding : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtension("header", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))>]
type SoapHeaderBinding = class
inherit ServiceDescriptionFormatExtension
Public Class SoapHeaderBinding
Inherits ServiceDescriptionFormatExtension
- 继承
- 派生
- 属性
示例
#using <System.dll>
#using <System.Web.Services.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
using namespace System::Xml;
int main()
{
ServiceDescription^ myServiceDescription = ServiceDescription::Read( "SoapHeaderBindingInput_cpp.wsdl" );
Binding^ myBinding = gcnew Binding;
myBinding->Name = "MyWebServiceSoap";
myBinding->Type = gcnew XmlQualifiedName( "s0:MyWebServiceSoap" );
SoapBinding^ mySoapBinding = gcnew SoapBinding;
mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http";
mySoapBinding->Style = SoapBindingStyle::Document;
myBinding->Extensions->Add( mySoapBinding );
OperationBinding^ myOperationBinding = gcnew OperationBinding;
myOperationBinding->Name = "Hello";
SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding;
mySoapOperationBinding->SoapAction = "http://tempuri.org/Hello";
mySoapOperationBinding->Style = SoapBindingStyle::Document;
myOperationBinding->Extensions->Add( mySoapOperationBinding );
// Create InputBinding for operation for the 'SOAP' protocol.
InputBinding^ myInputBinding = gcnew InputBinding;
SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding;
mySoapBodyBinding->Use = SoapBindingUse::Literal;
myInputBinding->Extensions->Add( mySoapBodyBinding );
SoapHeaderBinding^ mySoapHeaderBinding = gcnew SoapHeaderBinding;
mySoapHeaderBinding->Message = gcnew XmlQualifiedName( "s0:HelloMyHeader" );
mySoapHeaderBinding->Part = "MyHeader";
mySoapHeaderBinding->Use = SoapBindingUse::Literal;
// Add mySoapHeaderBinding to 'myInputBinding' object.
myInputBinding->Extensions->Add( mySoapHeaderBinding );
// Create OutputBinding for operation for the 'SOAP' protocol.
OutputBinding^ myOutputBinding = gcnew OutputBinding;
myOutputBinding->Extensions->Add( mySoapBodyBinding );
// Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
myOperationBinding->Input = myInputBinding;
myOperationBinding->Output = myOutputBinding;
myBinding->Operations->Add( myOperationBinding );
myServiceDescription->Bindings->Add( myBinding );
myServiceDescription->Write( "SoapHeaderBindingOut_cpp.wsdl" );
Console::WriteLine( "'SoapHeaderBindingOut_cpp.wsdl' file is generated." );
Console::WriteLine( "Proxy could be created using 'wsdl SoapHeaderBindingOut_cpp.wsdl'." );
}
using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;
public class MySampleClass
{
public static void Main()
{
ServiceDescription myServiceDescription =
ServiceDescription.Read("SoapHeaderBindingInput_cs.wsdl");
Binding myBinding = new Binding();
myBinding.Name = "MyWebServiceSoap";
myBinding.Type =new XmlQualifiedName("s0:MyWebServiceSoap");
SoapBinding mySoapBinding =new SoapBinding();
mySoapBinding.Transport="http://schemas.xmlsoap.org/soap/http";
mySoapBinding.Style=SoapBindingStyle.Document;
myBinding.Extensions.Add(mySoapBinding);
OperationBinding myOperationBinding = new OperationBinding();
myOperationBinding.Name = "Hello";
SoapOperationBinding mySoapOperationBinding =
new SoapOperationBinding();
mySoapOperationBinding.SoapAction = "http://tempuri.org/Hello";
mySoapOperationBinding.Style=SoapBindingStyle.Document;
myOperationBinding.Extensions.Add(mySoapOperationBinding);
// Create InputBinding for operation for the 'SOAP' protocol.
InputBinding myInputBinding = new InputBinding();
SoapBodyBinding mySoapBodyBinding = new SoapBodyBinding();
mySoapBodyBinding.Use = SoapBindingUse.Literal;
myInputBinding.Extensions.Add(mySoapBodyBinding);
SoapHeaderBinding mySoapHeaderBinding=new SoapHeaderBinding();
mySoapHeaderBinding.Message=new XmlQualifiedName("s0:HelloMyHeader");
mySoapHeaderBinding.Part="MyHeader";
mySoapHeaderBinding.Use=SoapBindingUse.Literal;
// Add mySoapHeaderBinding to 'myInputBinding' object.
myInputBinding.Extensions.Add(mySoapHeaderBinding);
// Create OutputBinding for operation for the 'SOAP' protocol.
OutputBinding myOutputBinding = new OutputBinding();
myOutputBinding.Extensions.Add(mySoapBodyBinding);
// Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
myOperationBinding.Input = myInputBinding;
myOperationBinding.Output = myOutputBinding;
myBinding.Operations.Add(myOperationBinding);
myServiceDescription.Bindings.Add(myBinding);
myServiceDescription.Write("SoapHeaderBindingOut_cs.wsdl");
Console.WriteLine("'SoapHeaderBindingOut_cs.wsdl' file is generated.");
Console.WriteLine("Proxy could be created using "
+"'wsdl SoapHeaderBindingOut_cs.wsdl'.");
}
}
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml
Public Class MySampleClass
Public Shared Sub Main()
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("SoapHeaderBindingInput_vb.wsdl")
Dim myBinding As New Binding()
myBinding.Name = "MyWebServiceSoap"
myBinding.Type = New XmlQualifiedName("s0:MyWebServiceSoap")
Dim mySoapBinding As New SoapBinding()
mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http"
mySoapBinding.Style = SoapBindingStyle.Document
myBinding.Extensions.Add(mySoapBinding)
Dim myOperationBinding As New OperationBinding()
myOperationBinding.Name = "Hello"
Dim mySoapOperationBinding As New SoapOperationBinding()
mySoapOperationBinding.SoapAction = "http://tempuri.org/Hello"
mySoapOperationBinding.Style = SoapBindingStyle.Document
myOperationBinding.Extensions.Add(mySoapOperationBinding)
' Create InputBinding for operation for the 'SOAP' protocol.
Dim myInputBinding As New InputBinding()
Dim mySoapBodyBinding As New SoapBodyBinding()
mySoapBodyBinding.Use = SoapBindingUse.Literal
myInputBinding.Extensions.Add(mySoapBodyBinding)
Dim mySoapHeaderBinding As New SoapHeaderBinding()
mySoapHeaderBinding.Message = New XmlQualifiedName("s0:HelloMyHeader")
mySoapHeaderBinding.Part = "MyHeader"
mySoapHeaderBinding.Use = SoapBindingUse.Literal
' Add mySoapHeaderBinding to 'myInputBinding' object.
myInputBinding.Extensions.Add(mySoapHeaderBinding)
' Create OutputBinding for operation for the 'SOAP' protocol.
Dim myOutputBinding As New OutputBinding()
myOutputBinding.Extensions.Add(mySoapBodyBinding)
' Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
myOperationBinding.Input = myInputBinding
myOperationBinding.Output = myOutputBinding
myBinding.Operations.Add(myOperationBinding)
myServiceDescription.Bindings.Add(myBinding)
myServiceDescription.Write("SoapHeaderBindingOut_vb.wsdl")
Console.WriteLine("'SoapHeaderBindingOut_vb.wsdl' file is generated.")
Console.WriteLine("Proxy could be created using " + _
"'wsdl /language:VB SoapHeaderBindingOut_vb.wsdl'.")
End Sub
End Class
注解
有关为 XML Web 服务指定协议的详细信息,请参阅 XML Web Services Using ASP.NET。 有关 Web 服务描述语言 (WSDL) 的详细信息,请参阅 WSDL 规范。
构造函数
SoapHeaderBinding() |
初始化 SoapHeaderBinding 类的新实例。 |
属性
Encoding |
获取或设置一个 URI,该 URI 表示用于对 SOAP 标头进行编码的编码样式。 |
Fault |
获取或设置一个扩展类型,它控制 WSDL 文档中 SOAP 标头的 |
Handled |
获取或设置一个值,该值指示当导入扩展性元素时,导入进程是否使用 ServiceDescriptionFormatExtension。 (继承自 ServiceDescriptionFormatExtension) |
MapToProperty |
获取或设置一个值,该值指示是否将 SoapHeaderBinding 实例映射到生成的代理类中的特定属性。 |
Message |
获取或设置一个值,该值指定 XML Web services 中应用 Message 的 SoapHeaderBinding 的名称。 |
Namespace |
获取或设置一个 URI,该 URI 表示 Encoding 属性未具体定义的内容编码规范的位置。 |
Parent |
获取 ServiceDescriptionFormatExtension 的父级。 (继承自 ServiceDescriptionFormatExtension) |
Part |
获取或设置一个值,该值指示 XML Web services 中应用 MessagePart 的 SoapHeaderBinding。 |
Required |
获取或设置一个值,该值指示 ServiceDescriptionFormatExtension 是否是它所引用的操作所必需的。 (继承自 ServiceDescriptionFormatExtension) |
Use |
指定是使用由 Encoding 属性指定的规则对标题进行编码,还是将标题封装在具体的 XML 架构中。 |
方法
Equals(Object) |
确定指定对象是否等于当前对象。 (继承自 Object) |
GetHashCode() |
作为默认哈希函数。 (继承自 Object) |
GetType() |
获取当前实例的 Type。 (继承自 Object) |
MemberwiseClone() |
创建当前 Object 的浅表副本。 (继承自 Object) |
ToString() |
返回表示当前对象的字符串。 (继承自 Object) |