When overridden in a derived class, allows a SOAP extension to initialize itself using the data cached in the SoapExtension.GetInitializer(LogicalMethodInfo, SoapExtensionAttribute) method.
- initializer
- The object returned from SoapExtension.GetInitializer(LogicalMethodInfo, SoapExtensionAttribute) cached by ASP.NET.
A SOAP extension has three opportunities to initialize data and they all have different purposes:
Class constructor - The class constructor is called every time a SOAP extension is instantiated and is typically used to initialize member variables.
SoapExtension.GetInitializer(LogicalMethodInfo, SoapExtensionAttribute) - SoapExtension.GetInitializer(LogicalMethodInfo, SoapExtensionAttribute), however, is called just once, the first time a SOAP request is made to an XML Web services method. If a custom attribute is applied to the XML Web service method, the SoapExtension.GetInitializer(LogicalMethodInfo, SoapExtensionAttribute) method is invoked. This allows the SOAP extension to interrogate the System.Web.Services.Protocols.LogicalMethodInfo of an XML Web service method for prototype information or to access extension-specific data passed by a class deriving from System.Web.Services.Protocols.SoapExtensionAttribute. The return value is cached by ASP.NET and passed into subsequent SoapExtension.Initialize(object) methods. Therefore, initialization done in SoapExtension.GetInitializer(LogicalMethodInfo, SoapExtensionAttribute) is encapsulated essentially into a one-time performance hit.
SoapExtension.Initialize(object) - SoapExtension.Initialize(object) is called every time a SOAP request is made to an XML Web service method, but has an advantage over the class constructor, in that the object initialized in SoapExtension.GetInitializer(LogicalMethodInfo, SoapExtensionAttribute) is passed to it.
You can also add a SOAP extension without deriving from System.Web.Services.Protocols.SoapExtensionAttribute by using the <soapExtensionTypes> Element in a configuration file. For details, see <soapExtensionTypes> Element and SOAP Message Modification Using SOAP Extensions.