URL

  • Thread starter Thread starter ViperGTS-R
  • Start date Start date
V

ViperGTS-R

Hi,

I've written a webservide which works fine. I call it from a C# class by
using a webreference. But now I want to place my webservice on another
webserver and that results in replacing the webreference and recompile the
code. My question is how I can prevent this. I used the webconfig.xml to put
in the serviceUrl but I do not manage to get it working.
In short the question is how cab I provide the URL of a webservice to a C#
application.

Thanks
Carlo
 
If you're using VS.NET you can set the URL Behavior property of the web
reference from Static to Dynamic. This will put the URL in your config file
and your application will look at this value when it executes.
 
In addition, if you want to code the config value yourself without using the
built-in behavior, simply call the .URL method of your web service (on the
client side) before calling any methods on it.

public void MyClientMethod()
{
MyWebService ws = new MyWebService();
ws.URL = ConfigSettings.GetConfig("MyWebServiceLocation");
ws.MyMethodCall();
}

--- N
 
Back
Top