SoapHeaderBinding クラス
XML Web サービス内の InputBinding または OutputBinding に追加される機能拡張要素を表します。
この型のすべてのメンバの一覧については、SoapHeaderBinding メンバ を参照してください。
System.Object
System.Web.Services.Description.ServiceDescriptionFormatExtension
System.Web.Services.Description.SoapHeaderBinding
Public Class SoapHeaderBinding
Inherits ServiceDescriptionFormatExtension
[C#]
public class SoapHeaderBinding : ServiceDescriptionFormatExtension
[C++]
public __gc class SoapHeaderBinding : public
ServiceDescriptionFormatExtension
[JScript]
public class SoapHeaderBinding extends
ServiceDescriptionFormatExtension
スレッドセーフ
この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。
解説
XML Web サービスのプロトコルの指定の詳細については、「 ASP.NET を使用した XML Web サービスの作成 」を参照してください。WSDL (Web Services Description Language) の詳細については、http://www.w3.org/TR/wsdl/ の仕様を参照してください。
使用例
Imports System
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 = "https://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 'Main
End Class 'MySampleClass
[C#]
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="https://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'.");
}
}
[C++]
#using <mscorlib.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(S"SoapHeaderBindingInput_cpp.wsdl");
Binding* myBinding = new Binding();
myBinding->Name = S"MyWebServiceSoap";
myBinding->Type = new XmlQualifiedName(S"s0:MyWebServiceSoap");
SoapBinding* mySoapBinding = new SoapBinding();
mySoapBinding->Transport=S"https://schemas.xmlsoap.org/soap/http";
mySoapBinding->Style=SoapBindingStyle::Document;
myBinding->Extensions->Add(mySoapBinding);
OperationBinding* myOperationBinding = new OperationBinding();
myOperationBinding->Name = S"Hello";
SoapOperationBinding* mySoapOperationBinding = new SoapOperationBinding();
mySoapOperationBinding->SoapAction = S"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(S"s0:HelloMyHeader");
mySoapHeaderBinding->Part=S"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(S"SoapHeaderBindingOut_cpp.wsdl");
Console::WriteLine(S"'SoapHeaderBindingOut_cpp.wsdl' file is generated.");
Console::WriteLine(S"Proxy could be created using 'wsdl SoapHeaderBindingOut_cpp.wsdl'.");
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System.Web.Services.Description
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
アセンブリ: System.Web.Services (System.Web.Services.dll 内)
参照
SoapHeaderBinding メンバ | System.Web.Services.Description 名前空間