Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Web Service (Dynamic URL)

 
Thread Tools Search this Thread
Old 06-08-2005, 11:43 PM   #1
Default 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.




Maziar Aflatoun
  Reply With Quote
Old 06-09-2005, 05:07 AM   #2
=?Utf-8?B?RGF2ZSBGYW5jaGVy?=
 
Posts: n/a
Default RE: Web Service (Dynamic URL)
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


=?Utf-8?B?RGF2ZSBGYW5jaGVy?=
  Reply With Quote
Old 06-10-2005, 05:42 PM   #3
MattB
 
Posts: n/a
Default Re: Web Service (Dynamic URL)
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


MattB
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Novice needs help with Adserver.Adtech.de CPU Rookie General Help Related Topics 3 05-10-2008 05:54 PM
Am new here and need help with virus/spyware cm punk General Help Related Topics 1 11-13-2006 11:04 AM
Trojan Horse! AHHH! okstatefan@swbell.net A+ Certification 11 02-08-2005 07:12 PM
'Dynamic Full' vs '2/8' means what? Dogger the Filmgoblin DVD Video 2 06-30-2004 09:03 AM
Re: High Gasoline Prices Create A+ Service Opportunities Frederic A+ Certification 3 01-17-2004 11:38 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46