Programmatically add / remove web reference in C#

T

TC

Hello All,

I have winforms app that accesses a webservice and the WSDL is referenced
dynamically.

I was wondering 2 things:

First, if one parses the .config file and changes the URL pointing to the
WSDL, I take it that these changes would not take effect until the user
closes and restarts the app, correct?

The above said, is there a way to programmtically upload the newly parsed
..config file, or, better yet, is there a way to programmatically remove the
old reference and add a new reference pointing to the new WSDL?

Thanks & Regards,

TC
 
K

Keenan Newton

Well I am assuming your trying to change the URL where your web service
is found at runtime. This is very easy to do by changing the URL
property on the generated web service proxy.

However, if your intent is to generate a new web service proxy on the
fly from a wsdl file. Then you would have to create your very own class
generator to interupt the wsdl, and generate a class file, compile that
file, and use refelction to call it up. To say the least not an easy
task.
 
T

TC

Hey Guys,

Yep. I now see the 'URL' property of the proxy object.

Thanks a bunch! It's exactly what I was looking for.

Regards,

TC
 

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,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top