473,395 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Programmatically add / remove web reference in C#

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

Nov 23 '05 #1
3 18988

"TC" <ge**********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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?
I take it you mean the Web Reference is dynamic, right? If so, then you are
correct, changes to the config file will not take effect until the app is
restarted. That's because the config file loader loads the .config file only
at first time you ask for a setting. After that all requests come from an
in-memory cache.

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?


If you just want to change the url of the Web Service proxy, assign to the
Url property of the proxy object. This works assuming the Web Service
interface (i.e., the WSDL) is the same.

Regards,
Sami
Nov 23 '05 #2
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.

Nov 23 '05 #3
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

"Keenan Newton" <ka*********@yahoo.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
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.

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Null Reference | last post by:
Anybody here who can explain or point me to a link ? I wish to create a blank MS Access DB file programmatically using C# . Thanks, nfs
3
by: Tzvika | last post by:
Hi, Is there a way to programmatically add/remove windows components in c# or in any other language What is the API fro that?
5
by: Carlo Marchesoni | last post by:
From an aspx page (A.aspx) I open another one (B.aspx - for table lookup). When the user selects an entry in B.aspx I would like to force a button's event in A.aspx to be fired. I guess the only...
1
by: Martine | last post by:
Hi there! I have a problem with programmatically adding user controls to my mobile webforms. If I load my usercontrol programmatically (in the Page_Load), the object is instantiated, I have...
4
by: BentleyInc | last post by:
I'm trying to find a way to add a whildcard application mapping to aspnet_isapi.dll in IIS programmatically.... been looking into IIS administrator reference but didn't find the right function to...
3
by: Neil | last post by:
I'm not sure where I should be asking this question but this seemed as good a starting point as any. I will shortly be building a asp.net application using v2 of the .net framework. I want to...
14
by: mistral | last post by:
Need php script to create mySQL database programmatically; since hosting configuration may not allow create database from script, script also need eliminate/rewrite all restrictions in appropriate...
0
by: | last post by:
I am wondering the best and easiest ways to use the VS.NETvisual designer with data controls that will will be loaded programmatically. For example, I have two datalist controls, one of which I'm...
12
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
I am writing a web app to be widely distributed where I do not know the installed .NET Framework version. I want to take advantage of some .NET 3.0 classes if they are installed, but gracefully...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.