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 Web 服务。
示例
以下 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