Load a webservice at runtime

J

Johnny Emde Jensen

Hellow group

I've made a webservice to handle datafetch between a database and a website.

On the website i want to place the location of the webservice in the
web.config an thereafter create the reference dynamically.

Do we have som examples for this? if its possible.
BYW i'am using C#

Kind regards
Johnny E. Jensen
 
A

Andrew Brook

Hiya,

If you added the reference to the webservice using the "add web
reference..." feature then you will find (if in visual studio you 'show all
files' in the project directory) a .cs file is generated - this is the
webservice proxy class. In the constructor of this class there will probably
be the hardcoded URL for the webservice, you could replace this with a
config file setting.

Alternatively, you could use WSDL.exe to generate the client proxy class for
you, it has an option for setting the url from a config file. This is the
method i generally use, plus it means you don't have to use the "add web
reference" function and you get to see a little more of whats going on
behind the scenes.

hope this helps
Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top