SoapHeaderAttribute.Direction プロパティ
SOAP ヘッダーの送信先が XML Web サービス、XML Web サービス クライアント、またはこれら両方かどうかを取得または設定します。
Public Property Direction As SoapHeaderDirection
[C#]
public SoapHeaderDirection Direction {get; set;}
[C++]
public: __property SoapHeaderDirection get_Direction();public: __property void set_Direction(SoapHeaderDirection);
[JScript]
public function get Direction() : SoapHeaderDirection;public function set Direction(SoapHeaderDirection);
プロパティ値
SOAP ヘッダーの目的の受信者。既定値は In で、目的の受信者が XML Web サービスだけであることを示します。
使用例
[Visual Basic, C#, C++] MyHeader
型の 1 つの SoapHeader を定義する MyWebService
XML Web サービスを次に示します。 Hello
XML Web サービス メソッドは、 MyHeader
を XML Web サービス メソッドおよびクライアントに送信して XML Web サービス メソッドを呼び出す必要があることを指定します。
Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols
' Define a SOAP header by deriving from the SoapHeader base class.
' The header contains just one string value.
Public Class MyHeader
Inherits SoapHeader
Public MyValue As String
End Class 'MyHeader
Public Class MyWebService
' Member variable to receive the contents of the MyHeader SOAP header.
Public myHeader As MyHeader
<WebMethod, _
SoapHeader("myHeader", Direction := SoapHeaderDirection.InOut)> _
Public Sub Hello()
End Sub 'Hello
End Class 'MyWebService
[C#]
using System;
using System.Web.Services;
using System.Web.Services.Protocols;
// Define a SOAP header by deriving from the SoapHeader base class.
// The header contains just one string value.
public class MyHeader : SoapHeader {
public string MyValue;
}
public class MyWebService {
// Member variable to receive the contents of the MyHeader SOAP header.
public MyHeader myHeader;
[WebMethod]
[SoapHeader("myHeader", Direction=SoapHeaderDirection.InOut)]
public void Hello() {
}
}
[C++]
#using <mscorlib.dll>
#using <System.EnterpriseServices.dll>
#using <System.Web.Services.dll>
using namespace System;
using namespace System::Web::Services;
using namespace System::Web::Services::Protocols;
// Define a SOAP header by deriving from the SoapHeader base class.
// The header contains just one string value.
public __gc class MyHeader : public SoapHeader {
public:
String* MyValue;
};
public __gc class MyWebService {
// Member variable to receive the contents of the MyHeader SOAP header.
public:
MyHeader* myHeader;
[WebMethod]
[SoapHeader(S"myHeader", Direction=SoapHeaderDirection::InOut)]
void Hello() {
}
};
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
SoapHeaderAttribute クラス | SoapHeaderAttribute メンバ | System.Web.Services.Protocols 名前空間