473,387 Members | 1,834 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,387 software developers and data experts.

dynamically connect to webservice

Hi All,

We're upgrading our web project - currently we have a web app and a web
service - both written in C#. The web app communicates with the web
service for login authentication, the list of who's logged in, messaging
between logged in users, etc. For this first pass, we hardcoded the
location of the web service to localhost/MyWebService. Now, we want to
allow more than one web app, but still have only one web service.
Obviously we can't have the hardcoded localhost/MyWebService anymore. I
was thinking of storing the URL of the webservice in the registry of
each IIS machine that has the web app installed. Now the hard part -
how do I dynamically get the web app to comminicate with a web service
that I don't know its URL at compile time? Any help / nudges in the
right direction are greatly appreciated.

Thanks in advance,

--Ed

Nov 18 '05 #1
1 1825
You can set the URL to the webservice dynamically at runtime from a setting
held somewhere like web.config

service = new thingService();
service.Timeout = 10000;
service.Url = ConfigurationSettings.AppSettings["WebServiceUrl"];

If your using VS.NET then choose the properties of the web service and
change the "Url Behavior" from "Static" to "Dynamic". This creates an entry
in the <appSettings> section of the Web.Config file that contains the Url
string.
--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Ed S" <ed-s.-a-t-.nospam.com> wrote in message
news:#w**************@TK2MSFTNGP12.phx.gbl...
Hi All,

We're upgrading our web project - currently we have a web app and a web
service - both written in C#. The web app communicates with the web
service for login authentication, the list of who's logged in, messaging
between logged in users, etc. For this first pass, we hardcoded the
location of the web service to localhost/MyWebService. Now, we want to
allow more than one web app, but still have only one web service.
Obviously we can't have the hardcoded localhost/MyWebService anymore. I
was thinking of storing the URL of the webservice in the registry of
each IIS machine that has the web app installed. Now the hard part -
how do I dynamically get the web app to comminicate with a web service
that I don't know its URL at compile time? Any help / nudges in the
right direction are greatly appreciated.

Thanks in advance,

--Ed

Nov 18 '05 #2

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

Similar topics

2
by: Michael R. | last post by:
Hello, Ich have some Problems with the call of a WebService! Situation: WebService is on the Internetserver The Webapplikcaion ist on the Intanetserver .... when I call the Webservice...
1
by: Germic | last post by:
Hi, How can we dynamically create a wrapper for an webservice? Example : I write an client application in C# that consumes a webservice, I need that application to read the URL of the WSDL file...
3
by: T-Man | last post by:
Hello, I have an application in C# that makes calls to a web service and the app currently contains a reference to a WSDL. Since the server technology is a commercial product, some customers...
2
by: Call Web service dynamically. | last post by:
I have VC++.NET application which takes the Webservice URL at the runtime from the user and it should call the webservice method based on what the user has supplied.
1
by: Antonello Calabṛ | last post by:
Hi all, I created a webservice that execute a sql query on demand. If I try to execute the query from the WebForm, all is ok. If I try to execute the query from a normal Windows Application,...
5
by: lavu | last post by:
I have a C# client application that uses a COM DLL(written in C++) or a webservice (the webservice is the same COM DLL wrapped up as a webservice). The client can dynamically (based on form...
1
by: satyaashok | last post by:
first iam create a webservice and it is consume in client web application now change parametars in the webservice ,now in client application with out update the webservice, it is update dynamically...
0
by: Wendi Turner | last post by:
ASP.NET 2.0 C# WebService Connect to Database: Sql Server 2005 --------------------------------------------------------------------------------------------------- I have successfully created a...
1
by: Wendi Turner | last post by:
ASP.NET 2.0 C# WebService Connect to Database: Sql Server 2005 --------------------------------------------------------------------------------------------------- I have successfully created a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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,...

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.