Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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)

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

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?

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
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?

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted
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...

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted

Excellent, that is exactly the behavior I wanted to see.

 

Solved. Thanks!

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...