ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 363
نمايش فراداده

SoapHeaderAttribute

System.Web.Services.Protocols (system.web.services.dll)sealed class

This attribute is used to receive a custom SoapHeader. Before you can use this attribute, you need to add a member variable of the appropriate SoapHeader type to your web service or proxy class (for example, Public ReceivedHeader As MyCustomHeader). Before invoking a method, the client will set this member to the appropriate header object. You must also add a SoapHeaderAttribute to each method that wants to process the custom header. This declaration specifies the class member that received the custom header object, as in [SoapHeader(MemberName = "ReceivedHeader"].

If a method will process more than one SoapHeader, just add multiple SoapHeaderAttribute declarations. You can also receive all headers that are not defined in the web service by creating a member array of SoapUnknownHeader objects and using it in the SoapHeaderAttribute declaration.

public sealed class 

SoapHeaderAttribute : Attribute { // Public Constructors public

SoapHeaderAttribute (string

memberName ); // Public Instance Properties public SoapHeaderDirection

Direction {set; get; } public string

MemberName {set; get; } public bool

Required {set; get; } // obsolete }

Hierarchy

System.Object System.Attribute SoapHeaderAttribute

Valid On

Method