Web Service : Passing data to and from Webservice & SOAP header


SOAP headers offer a method for passing data to and from an XML Web service method if the data is not directly related to the XML Web service method's primary functionality.

For instance, an XML Web service might contain several XML Web service methods that each require a custom authentication scheme. Instead of adding parameters to each XML Web service method for the custom authentication scheme, a SoapHeaderAttribute, referring to a class deriving from SoapHeader, can be applied to each XML Web service method. The implementation for the class deriving from SoapHeader handles the custom authentication scheme.

In this manner, the XML Web service method implements only the functionality specific to it and adds additional functionality using a SOAP header.

Reference: http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapheader.aspx

Skip to main content