Send Out-of-Band Data in a SOAP Header

Problem

You want to send some information to one or more Web methods without having to add it as a method parameter.

Solution

Create a custom SOAP header that encapsulates the additional information you need.

Discussion

Sometimes, you might need to submit information to a Web method that does not specifically relate to the method itself. This is most often the case when you are building your own custom authentication system or state management system, and you need to submit some type of credentials or tracking information every time you call the Web service. You can accommodate this information by inserting additional parameters into every method. However, this approach raises several problems, including:

  • The client ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook 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.