472,141 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,141 software developers and data experts.

Add web reference programatically

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

Thanks in advance
Feb 20 '07 #1
3 7043
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.
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"bbdobuddy" wrote:
I need to add a web reference programatically on the application's load
event. Can anybody help me out with this

Thanks in advance
Feb 20 '07 #2
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

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

Thanks in advance
Feb 20 '07 #3
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/rodo.../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


"bbdobuddy" wrote:
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

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

Thanks in advance
Feb 20 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Steve Bugden | last post: by
1 post views Thread by Nick via .NET 247 | last post: by
1 post views Thread by Chris Thunell | last post: by
275 posts views Thread by Astley Le Jasper | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.