7.3. Using Headers on the Client

When you add a Web reference to a Web service that uses SOAP headers, the generated code contains a class for each SOAP header defined in the Web service. Listing 7.4 shows an example proxy class for the above service. To improve readability, I removed all attributes and other code not relevant to this discussion.

Listing 7.4. An example proxy class that calls a Web service with SOAP headers (VBWSClientCode\Chapter7\CustomClient\Web References\VBWSServer1\Reference.vb)
 Public Class DataService Inherits SoapHttpClientProtocol Public HeaderClass1Value As HeaderClass1 Public HeaderClass2Value As HeaderClass2 <SoapHeaderAttribute("HeaderClass2Value", _ Direction:=SoapHeaderDirection.Out)> _ Public Sub ReturnHeader() ...

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.