Compartilhar via


SoapHeaderAttribute.Direction Propriedade

Definição

Obtém ou define se o cabeçalho SOAP destina-se ao serviço Web XML, o cliente do serviço Web XML ou ambos.

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

Valor da propriedade

SoapHeaderDirection

O destinatário pretendido do cabeçalho SOAP. O padrão é In, o que significa que o destinatário pretendido é apenas o serviço Web XML.

Exemplos

O serviço Web XML a seguir MyWebService define um SoapHeader tipo MyHeader. O Hello método de serviço Web XML especifica que MyHeader deve ser enviado para o método de serviço Web XML e o cliente para invocar o método de serviço Web XML.

#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

Aplica-se a