Setting SoapExtensions Programmatically
Creating a class that inherits from SoapExtension can provide (among other things) an easy way of logging XML that is passed between a client and server during Web Service calls. To apply your SoapExtension to an entire Web Service, then you can make changes in the Web.config file.
Likewise, if you are running a client application then you can add a
However, if you are connecting to a Web Service from a class library then how do you get your logging?
I've just had this problem. We have code running as a COM+ server, so we can't add the setting to the app.Config file. I suppose if we wanted to we could add it to the dllhost.exe.config file, or mess around with the Application Root Directory, but for a number of reasons these aren't really an option.
But we can set SoapExtensions programmatically in our code:
- Create the SoapExtension class you want to use
- Create a SoapExtensionAttribute class, overriding the ExtensionType property
- Apply the attribute to the method.
No comments:
Post a Comment