I'm trying to create a SoapExtension for my Web services. I've written my own extension, bought a book and installed...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
the samples and even downloaded samples. Everything looks good but the SoapExtension objects never get instantiated. The GetInitializer never gets called in any of them. I've tried both the web.config and attributes to get it to hook in. Is there some global setting somewhere I am missing or something?
Well, a SOAP extension is configured in one of 2 places for ASP.NET to use it. Are you using it locally to an application or globally on the server? After building a SoapExtension, it can be configured to be used for just a single directory, or for all applications on the server.
To set it up for a single virtual directory, start by placing the assembly in the local bin directory. Next modify web.config as follows to direct ASP.NET to load your new extension:
If it does not already exist, create a new element under <system.web> called <webServices>. then create a <soapExtensionTypes> element under that. Here is an example extension web.config entry from MSDN:
<webServices> <soapExtensionTypes> <add type="PrioritySoapHeaderExtension.PriorityHeaderExtension, PrioritySoapHeaderExtension" priority="1" group="0" /> </soapExtensionTypes> </webServices>
The type attribute of the add element indicates the class type that implements the SoapExtension with the added assembly name after the comma. The priority and group elements allow you to make settings so that you have some control over the order in which this extension will be loaded.
If you want your extension to be available globally for all virtual directories, you will need to place it in the Global Assembly Cache or GAC. You must be assured you have given your assembly a strong name. For more information see the following link in MSDN:
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.