SoapHeaderAttribute.Direction 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
可取得或設定 SOAP 標頭是針對 XML Web 服務、XML Web 服務用戶端,或兩者皆有。
public:
property System::Web::Services::Protocols::SoapHeaderDirection Direction { System::Web::Services::Protocols::SoapHeaderDirection get(); void set(System::Web::Services::Protocols::SoapHeaderDirection value); };
public System.Web.Services.Protocols.SoapHeaderDirection Direction { get; set; }
member this.Direction : System.Web.Services.Protocols.SoapHeaderDirection with get, set
Public Property Direction As SoapHeaderDirection
屬性值
SOAP 標頭的預定接收者。 預設為 In,表示預期接收者僅為 XML 網路服務。
範例
以下 MyWebService XML Web 服務定義了一個 SoapHeader 型別 MyHeader為 的 。
Hello XML Web 服務方法指定MyHeader必須傳送給 XML Web 服務方法及客戶端以呼叫 XML Web 服務方法。
#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 ref class MyHeader: public SoapHeader
{
public:
String^ MyValue;
};
public ref class MyWebService
{
public:
// Member variable to receive the contents of the MyHeader SOAP header.
MyHeader^ myHeader;
[WebMethod]
[SoapHeader("myHeader",Direction=SoapHeaderDirection::InOut)]
void Hello(){}
};
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() {
}
}
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
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
End Class