Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > dynamically connect to webservice

Reply
Thread Tools

dynamically connect to webservice

 
 
Ed S
Guest
Posts: n/a
 
      11-29-2003
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

 
Reply With Quote
 
 
 
 
John Timney \(Microsoft MVP\)
Guest
Posts: n/a
 
      11-29-2003
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:#(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem to call a WEBSERVICE in another WEBSERVICE (AXIS/ TOMCAT) Cyril Java 2 06-01-2006 06:07 PM
Problem! webservice.htc calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 1 01-26-2006 12:05 PM
Problem! webservice.htc calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 0 01-26-2006 08:13 AM
WebService on Java server versus WebService on .NET Mr. x Java 2 10-09-2003 11:21 PM
use another webservice in a webservice Mr. x ASP .Net Web Services 0 09-26-2003 10:59 PM



Advertisments