When overridden in a derived class, allows a SOAP extension to initialize data specific to an XML Web service method using an attribute applied to the XML Web service method at a one time performance cost.
- methodInfo
- A System.Web.Services.Protocols.LogicalMethodInfo representing the specific function prototype for the XML Web service method to which the SOAP extension is applied.
- attribute
- The System.Web.Services.Protocols.SoapExtensionAttribute applied to the XML Web service method.
The object that the SOAP extension initializes for caching.
If the SOAP extension is configured using a configuration file see the SoapExtension.GetInitializer(LogicalMethodInfo, SoapExtensionAttribute) overload that accepts a Type.
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.