I created the dynamic webservice. So far so good. Solved some hard to find problems (at least, Microsoft doesn’t tell you that these problems will arise). Now for the big finale. WCF in all its wisdom caches WSDL requests. Let us repeat that all together now: WCF caches WSDL requests. And there is no way to tell WCF to not do that, or for that matter to empty the cache. The only way to do that, is to recycle the application pool the service is running in, or (of course) to recycle IIS. It’s that bad.
I tried several methods: messageinterceptors, creating extra instances of the service, etc etc but there’s no way to work around the cache. Once requested, the WSDL is written in stone.
We serve web services that have a customerbased configuration. A customer gives us a data file, which will be the source for their endpoint. In our application is defined which columns are served to the respective methods. But all clients have the same set of methods (web operations). So the wsdl generator looks at the user that is logged in (custom servicebehavior), fetches the relevant column names from the database, and modifies the wsdl accordingly. Every customer is served its own data with its own choice of columns. Works perfectly. Until you change the set of columns and don’t restart the service. No problem on my development laptop or on the test machine, but a big problem if we want this in live in production.
At a dead end with this now. Looking for an alternative. But so far, none of what I find actually works.