Exploring the Header in the WSE 2.0 SoapEnvelope Class - SOAP Headers
(Page 2 of 4 )
The function of the envisaged use of a SOAP Header is to provide support for extending the message content. The SOAP header might be used for message routing, transaction management, user authentication, etc.
The XML grammar rules applies to the SOAP Header as to its name (Header) and its position in the SOAP Envelope (the first immediate child of Soap Envelope); any other entries in the Header are its children and they are all namespace qualified. Other entries in the Header may be used by the intermediaries in the message route for processing of the message by that node.
As discussed earlier, in the first part of this two part series, while the Body element is mandatory in the SOAP Message, the Header is optional. There is a difference in how the SOAP specification treats the Header element in a SOAP message, and how Microsoft defines the Soap Header. Visual Studio IDE 2003 can manipulate headers.
The SOAP specification does not strictly define the headers. Therefore, a class containing the data in the header has to be created for adding header information for web services created by the IDE. This class is derived from the SoapHeader class. This tutorial shows how this is done.
Manipulating SoapHeader in Visual Studio .NET 2003
Create a new project of type web service, called Hdrs in this tutorial. Follow the earlier steps discussed in part one of this series to add a reference to WSE2.0 and a new web service, named SopHdr.asmx in this tutorial. Since we would like to look at the SoapEnvelope's Header property we will create a Public Class jhdr whose code is shown here [HdrInfo.vb] after the picture.

Next: Code for the Public Class >>
More Windows Scripting Articles
More By Jayaram Krishnaswamy