473,775 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic Web Service calls

Hi,

Is there a way to connect to a Web Service dynamically at runtime (Web
Reference URL)? I have always used Visual Studio to create a Web Reference
and then used it in my code. However, that always requires the URL to the
Web Service to be the same on the staging site and the production site. Now
I have two instances of the same application running (Staging site and
Production) and want to store the URL in a file instead. Is there a way to
do this?

ex. Web.Config AppSetting <add key="WebService URL"
Value=http://....webserv.asm x>

Thank you
Maz.
Nov 23 '05 #1
4 4172
In the properties window of the Web Reference set the property

URL Behavior = Dynamic

This will put an entry into the app.config file that looks something like
this:

<add key="MyApp.Test Service.TestSer vice"
value="http://MyServer/MyVirtualDir/MyService.asmx"/>

Which can be edited to reflect the server you wish to work on either in the
app.config directly or in the Web Reference properties again by changing the
Web Reference URL property
"Maziar Aflatoun" wrote:
Hi,

Is there a way to connect to a Web Service dynamically at runtime (Web
Reference URL)? I have always used Visual Studio to create a Web Reference
and then used it in my code. However, that always requires the URL to the
Web Service to be the same on the staging site and the production site. Now
I have two instances of the same application running (Staging site and
Production) and want to store the URL in a file instead. Is there a way to
do this?

ex. Web.Config AppSetting <add key="WebService URL"
Value=http://....webserv.asm x>

Thank you
Maz.

Nov 23 '05 #2
In the properties window of the Web Reference set the property

URL Behavior = Dynamic

This will put an entry into the app.config file that looks something like
this:

<add key="MyApp.Test Service.TestSer vice"
value="http://MyServer/MyVirtualDir/MyService.asmx"/>

Which can be edited to reflect the server you wish to work on either in the
app.config directly or in the Web Reference properties again by changing the
Web Reference URL property
"Maziar Aflatoun" wrote:
Hi,

Is there a way to connect to a Web Service dynamically at runtime (Web
Reference URL)? I have always used Visual Studio to create a Web Reference
and then used it in my code. However, that always requires the URL to the
Web Service to be the same on the staging site and the production site. Now
I have two instances of the same application running (Staging site and
Production) and want to store the URL in a file instead. Is there a way to
do this?

ex. Web.Config AppSetting <add key="WebService URL"
Value=http://....webserv.asm x>

Thank you
Maz.

Nov 23 '05 #3
"=?Utf-8?B?U3RldmU=?=" <St***@discussi ons.microsoft.c om> wrote in
news:19******** *************** ***********@mic rosoft.com:
Which can be edited to reflect the server you wish to work on either in
the app.config directly or in the Web Reference properties again by
changing the Web Reference URL property


You can also set this property using code directly.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu
Nov 23 '05 #4
"=?Utf-8?B?U3RldmU=?=" <St***@discussi ons.microsoft.c om> wrote in
news:19******** *************** ***********@mic rosoft.com:
Which can be edited to reflect the server you wish to work on either in
the app.config directly or in the Web Reference properties again by
changing the Web Reference URL property


You can also set this property using code directly.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu
Nov 23 '05 #5

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

Similar topics

18
526
by: jabailo | last post by:
I wrote a program that loops through a file of records. It parses each line in the file and sends them to a web service that inserts them into an AS400DB2 database using Asynch calls. This is the wierd part. Say their are 500 records in the file. If I run the process once, maybe 250 will appear. If I run it a second time, maybe 400 or all the records will appear.
0
1057
by: Wajih-ur-Rehman | last post by:
Hello group, I have a window service that is a client to a Web Service. In the app.config file of my window service, i specify the url of the web service. When i compile it and run it, it goes to the correct url but if i stop the window service and run it again without ANY change to the code, it does not go to the specified url in the app.config file, rather it calls the same web service but on localhost (that i was using initially for...
8
2541
by: Eyeawanda Pondicherry | last post by:
I have put some code together that creates an enum dynamically from some database values. The enum can be read perfectly by an application that references the dynamically generated dll. If I /emit/ a new version of the assembly, and start the application again, the new values will appear for the enum. However, suppose I want the application to remain in a running state.
7
1762
by: Ollie Riches | last post by:
I know this has probably been asked a lot but I can't find any good exmaples so.... Can anyone give some url's to C# code that dynaimcally generates a web service proxy at runtime? Cheers Ollie Riches http://www.phoneanalyser.net
5
3084
by: Demetri | last post by:
Is it possible to add a web service reference during runtime? If so, how? -- -Demetri
7
22497
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We added an entry to the executable's .exe.config file to specify the URL, and under the 1.1 framework this worked well. Unfortunately, this is not working under the 2.0 framework. I see in the Reference.cs file under the web service reference the...
2
2540
by: James | last post by:
Hello, I have an existing MFC C++ project which I need to add the ability of sending WSDL calls out to a web service. When this project is deployed the web service URL will always change depending on the user's local setup. I can use the "Add a Web Reference" wizard to do this, however when the project is in C++ the option to set the URL Behaviour to Dynamic is not in the property list. I noticed if I create a C# project however,...
2
7053
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply. Each dynamically created row will return 3 values fee1_choice, fee1_unit and fee1_money. Note The above informaton is...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10268
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10107
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9916
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7464
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6718
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4017
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.