Friday, April 15, 2005 12:42 AM
xsherry
How do you deal with development vs. production web services?
A question came up in a forum that I frequent, about web references in a web service client application. The gist was that the poster had a web service deployed in both development and production, and needed the client app to also be able to switch between the two.
There are a couple of ways that I've thought of to handle this.
1) Brute force. Create a web method for the development service, code to it, and before you deploy delete it and create a reference to the production service with the same name.
I don't like this option at all.
2) Create two web references, and write lots of ugly conditional code all the way through your app to deal with it. This is my *least* favorite option.
3) Create a base class for your proxy classes, or an interface. (I like the interface better, because both the web service itself and the proxy classes could implement it.) Lots of work either way.
4) I *think* (but I haven't tried it) that you *should* be able to switch the URL in the proxy class, say, based on a configuration setting. If this would work, it'd be by far the easiest and cleanest method.
If, however, you ever regenerated the proxy class, this would fail silently, and you might not know the difference until it was too late, which is an edge that the interface might have.
Any thoughts? Any obvious (or not so obvious) methods that I've missed? What are people doing in the real world in these situations?