
Initialize SOAP Extension Specific Data
The class that derives from SoapExtension has two methods for initializing data, GetInitializer and Initialize(Object).
At what time the ASP.NET infrastructure calls the GetInitializer method, and what parameters are passed to the method, depend on how the SOAP extension is configured. (See SOAP Message Modification Using SOAP Extensions and Configure the SOAP Extension to Run with Web Service Methods.
To initialize data when the SOAP extension is configured using an attribute
Implement the GetInitializer method using the following signature:
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute)
Public Overloads Overrides Function GetInitializer(methodInfo As _
LogicalMethodInfo, attribute As SoapExtensionAttribute) As Object
The LogicalMethodInfo provides prototype details about the Web service method, such as the number of parameters and their data types.
If necessary, call the Initialize(Object) method, passing the object returned by GetInitializer. For many SoapExtension implementations, the Initialize(Object) method can be left empty.
To initialize data when the SOAP extension is configured in a configuration file
Implement the GetInitializer method with the following signature:
public override object GetInitializer(Type WebServiceType)
Public Overloads Overrides Function GetInitializer(WebServiceType As Type) As Object
The Type parameter is the type of the class of the class that implements the Web service.
If necessary, call the Initialize(Object) method, passing the object returned by GetInitializer. For many SoapExtension implementations, the Initialize(Object) method can be left empty.
For an example of how to initialize cached data when a SOAP extension is configured see, How to: Initialize Cached Data When a SOAP Extension is Configured.