Name
SoapHeader
Synopsis
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 ...
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.