Επεξεργασία

Κοινή χρήση μέσω


SoapHeaderDirection Enum

Definition

Specifies whether the recipient of the SoapHeader is the XML Web service, the XML Web service client, or both.

This enumeration supports a bitwise combination of its member values.

public enum class SoapHeaderDirection
[System.Flags]
public enum SoapHeaderDirection
[<System.Flags>]
type SoapHeaderDirection = 
Public Enum SoapHeaderDirection
Inheritance
SoapHeaderDirection
Attributes

Fields

Name Value Description
In 1

Specifies the SoapHeader is sent to the XML Web service.

Out 2

Specifies the SoapHeader is sent to the XML Web service client.

InOut 3

Specifies the SoapHeader is sent to both the XML Web service and the XML Web service client.

Fault 4

Specifies the SoapHeader is sent to the XML Web service client when an exception is thrown by the XML Web service method.

Examples

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

Remarks

A SoapHeaderAttribute can be applied to either an XML Web service method or a method of a proxy class to an XML Web service. In either case, the recipients are specified by the SoapHeaderAttribute.Direction property. To 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.

Applies to

See also