Add web reference programatically

G

Guest

I need to add a web reference programatically on the application's load
event. Can anybody help me out with this

Thanks in advance
 
G

Guest

I think you need to improve the description of the problem. You cant add a
brand new reference to a web service at runtime as your code wont use it at
all and it would therefore be useless. You can however specify for the URL
for a reference to be held in the config file so it can be changed if thats
what your after.
 
G

Guest

I found out some info. I think all I need to do is to change the url in the
web services proxy. Does anyone have any code that I could see how to do this

Thanks
 
G

Guest

What you are describing is *NOT* "adding a webreference programatically". You
are describing setting the Url property of a pre-existing webService proxy
client class at runtime. You can do this by simply pulling out your url from
an appSettings element in the web.config, or from a database, and setting the
Url property just before making the proxy method call.

This code here
http://weblogs.shockbyte.com.ar/rodolfof/archive/2007/01/09/10698.aspx
*IS* an example of dynamically creating a webreference and proxy class.
There are other similar such examples should you care to look.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
 

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

Top