7.1. Defining SOAP Headers

The first step in using SOAP headers is to define a class that represents the header you want to send or receive. This class must inherit from the base class System.Web.Services.Protocols.SoapHeader and add public members that represent the header information you need. Listing 7.1 shows two classes that represent two different SOAP headers, each with two public fields.

Listing 7.1. Two SOAP header classes (VBWSBook\Chapter7\DataService.asmx.vb)
Public Class HeaderClass1
    Inherits SoapHeader
    Public field1 As Integer
    Public field2 As String
End Class
Public Class HeaderClass2
    Inherits SoapHeader
    Public fielda As Integer
    Public fieldb As String
End Class

Because your SOAP headers are simply classes, they can also contain ...

Get Real World XML Web Services: For VB and VB .NET Developers 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.