473,472 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Web Service (Dynamic URL)

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="WebServiceURL"
Value=http://....webserv.asmx>

Thank you
Maz.
Nov 19 '05 #1
2 3839
You can dynamically set the URI of a web service using web.config but you
need to edit the proxy class to do it. You can get to the proxy class
through the object browser (or you can open it directly by navigating through
the web references folder structure). Once in the proxy class, just look for
the URI and replace it with a read from your web.config.

One drawback to this is that if you need to regenerate your proxy class,
you'll need to update the URI again.

HTH
----
http://www.davefancher.com
Nov 19 '05 #2
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="WebServiceURL"
Value=http://....webserv.asmx>

Thank you
Maz.


I just have a web.config setting (in appSettings) like this:

<add key="MyApp.localhost.MyService"
value="http://10.10.10.1/VirDir/MyService.asmx"/>

I have a Web Reference to my service on localhost that I use for testing
and development. If I want to point to somewhere else this entry
redirects to another location without having to modify anything else.

HTH!

Matt
Nov 19 '05 #3

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

Similar topics

1
5
by: krisk | last post by:
Could not find ansewr: in ProjectInstaller, RunInstallerAttribute: ..... this.serviceInstaller1.ServiceName = MyServiceName; in the code: public class MyService :...
5
by: Demetri | last post by:
Is it possible to add a web service reference during runtime? If so, how? -- -Demetri
15
by: Nak | last post by:
Hi there, Is it possible to load a web service dynamically? i.e. If the web service were to exist on a system with a non static IP address, an application could download a "locator" file that...
0
by: blekros | last post by:
All, I have a web service client written in VB.NET. It is a class library assembly (.dll file). I made a web reference to a web service and set it to be dynamic, so it puts the URL of the...
5
3
by: JL | last post by:
I have a VB.NET desktop program that reads/writes data to a server using a Java-based Web Service. This web service, in identical formats, is located on several servers with each server being a...
1
by: Chad | last post by:
I created my first simple web service on my local PC> I tested it using the test page that is generated for you. I then created a standalone app, and in the IDE, set a reference to the local web...
3
by: lk | last post by:
I need some help regarding the mechanism to put in place to be able to dynamically update a remote object when the assembly where it is defined is modified, and this whitout having service...
4
by: =?Utf-8?B?Z3Jhenph?= | last post by:
Hello If someone can help me with this it would be greatly appreciated. I’m no web service expert but I don't think i'm trying to do anything too special. I think i must be missing something...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
10
1
by: Spam Catcher | last post by:
Hi all, I'm deploying a web site application to a production server. The web site contacts a back end web service (part of this project) and in development it uses http://localhost:4161/. In...
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
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...
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,...
15
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.