Use Of Web Service (WCF/ASMX) Design Thoughts

Nate Bross

Contributor
Joined
Apr 6, 2005
Messages
601
Location
Chicago, IL
I am about to be developing a solution in which I rely on several outside (out of my control) web services (both WCF and ASMX). Each individual service provides multiple methods and business objects that relate to said service. Each service also has a test/dev endpoint, as well as a production endpoint: test.service.com and production.service.com.

This is sort of a two-parter:

First, am I correct in that all I should have to do is swap the endpoint address from the app.config file when I am ready to go from test to production? (Assuming that I am able to get a valid token for production access?)

Second, my application will be relying heavily on these services, but only using a limmited portion of their functionallity. Is it wise to make my own "wrapper" classes (in seperate class library?) and then have my application take advantage of my class library instead of directly talking to the services?

Thanks for any responses! (Sorry for being longwinded)
 
If the test and production services expose the same functionality then you should be able to just swap endpoints, asuming other considerations (like security) are taken care of.

Personally I would only bother to wrap the functionality in my own class library if I was using these services in multiple projects or if these services had a overly complex / confusing API I was trying to encapsulate.
 
Thanks, the services do expose the same functionallity, so hopefully just swapping end points will work for me.

I will probably be using these services in multiple projects and they are very complex and provide alot of functionallity (of which I'll only be using a small portion). So I think I'm leaning toward encapsulation.

I know that you can define your own proxy in code and set your endpoints and other configurations there. Would it be a good idea to setup my class library to do this, and then allow an instance of my class to manage creating the proxy for each call?
 
I would create a single classlibrary that encapsulates the useful functionality from the webservice and just exposes this as simple methods / classes to the calling applications.

All the actual proxy instantiation etc. would be done entirely inside this dll and the calling applications wouldn't get involved directly.
 
My thought was to use an Enum Flag (Mode.Production | Mode.Test) and pass that as a parameter for instantiating the class initially. Is there a better design I might use?
 
Would this be the config file of said class library (myclasslib.dll.config) or in the application (myapp.exe.config)? This has always confused me...
 
If you use VS 2005 or later's settings property page then the class library just gets a section in the calling applications config file - this way you can keep the code in one place (the dll) but configure it on an app by app basis.
 
Back
Top