Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic web services 1

Status
Not open for further replies.

Zarcom

Programmer
May 7, 2002
1,275
CA
Hey peoples

I was wondering if anyone knows how to or if it is possible to have a project that depending on an attribute in the .config file pointed to a different server from which to grab it's web services from.

I would like to distribute this app and depending on who is hosting it I want it to point to a different web service server.

thanks for any ideas/alternatives/solutions you've got That'l do donkey, that'l do
[bravo] Mark
 
Hey Mark,

So is this how it would work: code would check the config file and use the link there to hit the webservice?

If so...um, thats probably all you need to do (just always put the config.attributes("webserviceurl") or whatever attribute you call it into your code whenever you need to access the webservice), unless there's another part to it.

D
 
Yes, what you want is possible.
When you include the web reference to your project, chnge the 'URL Behavior' propety to 'Dynamic' instead of the default 'Static' value.
Then, it will automaticlly include a tag on your web.config (or on your app.config if you're using a win app) like:
<configuration>
<appSettings>
...
<add key=&quot;WebUI.sClientes.sClientes&quot; value=&quot;...
</appSettings>
</configuration>

Then all you need to do is change the path for each host. It automaticlly looks for the webserver on the path you wrote.

CAUTION: Do not change the key, or it will not work properly.

NetAngel
 
kudos bud That'l do donkey, that'l do
[bravo] Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top