O'Reilly logo

Real World XML Web Services: For VB and VB .NET Developers by Yasser Shohoud

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.2. Using Headers on the Service

After defining your header classes, you need to specify which Web methods will use these headers. First, you declare public member variables of the types of headers you want to use. For example, Listing 7.2 shows a Web service with two member variables: one of type HeaderClass1 and one of type HeaderClass2. Note that the member variables must be public.

Listing 7.2. A Web service with two member variables representing two SOAP headers (VBWSBook\Chapter7\DataService.asmx.vb)
Public Class DataService
    Inherits System.Web.Services.WebService

    'header fields must be public
    Public inputHeader As HeaderClass1
    Public outputHeader As HeaderClass2
End Class

You add a SoapHeaderAttribute attribute to each Web method that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required