SoapHeaderAttribute.Direction Property

Definition

Gets or sets whether the SOAP header is intended for the XML Web service or the XML Web service client or both.

C#
public System.Web.Services.Protocols.SoapHeaderDirection Direction { get; set; }

Property Value

The intended recipient of the SOAP header. The default is In, which means the intended recipient is just the XML Web service.

Examples

The following MyWebService XML Web service defines one SoapHeader of type MyHeader. The Hello XML Web service method specifies that MyHeader must be sent to the XML Web service method and the client to invocate the XML Web service method.

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() {
    }
}

Applies to

Produto Versões
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1