SoapHeader

SoapHeader

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

This class allows you to create custom SOAP headers, which are used to send additional information to or from a web service. For example, rather than require an extra security parameter to authenticate every web service method, you could use a custom SoapHeader. The client could then set a simple property of the proxy class, and the header would be sent automatically with every web method request.

To use a custom SoapHeader, create a class that inherits from SoapHeader, and add the member variables you need to contain additional information (in this case, some sort of security credentials). When invoking a method, instantiate your custom SoapHeader, set its properties accordingly, and send it to the web service or proxy class. The web service must provide a member variable to receive the SoapHeader and must indicate which methods will process the custom header. It marks these methods with a SoapHeaderAttribute.

The Actor property is specified by the SOAP standard and should be set to the URL of the web service. If you set the MustUnderstand property to True, the method in the class receiving the message must set the DidUnderstand property to True, or a SoapHeaderException will be thrown. Note that ASP.NET automatically defaults MustUnderstand to True and automatically defaults DidUnderstand to True as long as the recipient (for example, the web service) contains the custom header class definition. The only time DidUnderstand will not be automatically set to True is when you explicitly retrieve unknown SOAP headers.

public abstract class SoapHeader { // Protected Constructors    protected SoapHeader( ); // Public Instance Properties    public string Actor{set; get; }    public bool DidUnderstand{set; get; }    public string EncodedMustUnderstand{set; get; }    public bool MustUnderstand{set; get; } }

Subclasses

SoapUnknownHeader

Returned By

SoapHeaderCollection.this

Passed To

SoapHeaderCollection.{Add( ), Contains( ), CopyTo( ), IndexOf( ), Insert( ), Remove( ), this}



ASP. NET in a Nutshell
ASP.NET in a Nutshell, Second Edition
ISBN: 0596005202
EAN: 2147483647
Year: 2003
Pages: 873

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net