SoapHeaderDirection 枚举

定义

指定 SoapHeader 的接收者是 XML Web services、XML Web services 客户端还是两者都是。Specifies whether the recipient of the SoapHeader is the XML Web service, the XML Web service client, or both.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

public enum class SoapHeaderDirection
[System.Flags]
public enum SoapHeaderDirection
type SoapHeaderDirection = 
Public Enum SoapHeaderDirection
继承
SoapHeaderDirection
属性

字段

Fault 4

指定 XML Web services 方法引发错误时,将 SoapHeader 发送到 XML Web services 客户端。Specifies the SoapHeader is sent to the XML Web service client when an exception is thrown by the XML Web service method.

In 1

指定将 SoapHeader 发送到 XML Web services。Specifies the SoapHeader is sent to the XML Web service.

InOut 3

指定将 SoapHeader 发送到 XML Web services 和 XML Web services 客户端。Specifies the SoapHeader is sent to both the XML Web service and the XML Web service client.

Out 2

指定将 SoapHeader 发送到 XML Web services 客户端。Specifies the SoapHeader is sent to the XML Web service client.

示例

下面的 XML Web service 方法指定myHeader SoapHeader从 XML Web service 客户端发送到 XML Web service 然后返回到 XML Web service 客户端, 而不考虑在执行期间引发的异常 XML Web service付款方式.The following XML Web service method specifies that the myHeader SoapHeader is sent from the XML Web service client to the XML Web service and then back to the XML Web service client, regardless of an exception thrown during execution of the XML Web service method.

public ref class MyHeader: public SoapHeader
{
public:
   String^ MyValue;
};

public ref class MyWebService
{
public:
   MyHeader^ myHeader;

   [WebMethod]
   [SoapHeader("myHeader",
   Direction=SoapHeaderDirection::InOut|SoapHeaderDirection::Fault)]
   void MySoapHeaderReceivingMethod()
   {
      
      // Set myHeader->MyValue to some value.
   }

};

public class MyHeader : SoapHeader {
    public string MyValue;
}

public class MyWebService {

    public MyHeader myHeader;

    [WebMethod]
    [SoapHeader("myHeader", 
                Direction=SoapHeaderDirection.InOut | SoapHeaderDirection.Fault)]
    public void MySoapHeaderReceivingMethod() {

        // Set myHeader.MyValue to some value.

    }
}
   
Public Class MyHeader
    Inherits SoapHeader
    Public MyValue As String
End Class

Public Class MyWebService
    
    Public myHeader As MyHeader    
    
    <WebMethod, _
    SoapHeader("myHeader", _
                Direction := SoapHeaderDirection.InOut Or SoapHeaderDirection.Fault)> _
    Public Sub MySoapHeaderReceivingMethod()

        ' Set myHeader.MyValue to some value.
        
    End Sub
    
End Class

注解

SoapHeaderAttribute可应用于 XML Web service 的 XML Web service 方法或代理类的方法。A SoapHeaderAttribute can be applied to either an XML Web service method or a method of a proxy class to an XML Web service. 在任一情况下, 接收方均由SoapHeaderAttribute.Direction属性指定。In either case, the recipients are specified by the SoapHeaderAttribute.Direction property. 若要指定在其执行过程中引发异常时 XML Web service 方法返回 SOAP 标头, 请将应用SoapHeaderAttribute到方法, 并SoapHeaderAttribute.Direction将属性设置为FaultTo specify that an XML Web service method returns a SOAP header when an exception is thrown during its execution, apply a SoapHeaderAttribute to the method and set the SoapHeaderAttribute.Direction property to Fault.

适用于

另请参阅