RE: Help with my my Hello World web service



You have a couple options. In the properties of your WebReference, you can
set the UrlBehavior property to Dynamic. This will create an entry in the
web.config file for your web service that you can edit.

A better way IMO is to leave the WebReference UrlBehavior set to Static but
after you instantiate the proxy in your application you can simply set the
Url property to whatever you want. In the environment where I work, we do
this to configure for local, development, test, or production environments.

In web.config, add an entry:

<add key="WSUrl-Production"
value="http://mywebserver/mywebserviceapp/my.asmx";>

Then, in code we get the url for the environment we're in:

MyWebService.Proxy proxy = new MyWebService.Proxy();
proxy.Url = System.Configuration.ConfigurationSettings.AppSettings["WSUrl-"
+ currentEnvironment];

While I do it in we.config in my environment, you could do it in app.config
the same way for WinForms.

That's all there is to it.

HTH
--
Dale Preston
MCAD C#
MCSE, MCDBA


"Chad" wrote:

> 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 service. I was able to call it
> successfully.
>
> The next step, I want to move it to a remote server and try to call that. I
> expect that that shoudl work.
>
> What I do not know how to do is this:
>
> I would like to make the URL of the location of the web service
> dynamic/parameterized or read from a file, so when I release the web app
> consumer program, I can change the consumer to point to either the
> production or development web service.
>
> Many thanks for any feedback
>
>
>
>
>
.



Relevant Pages

  • RE: Consume REST Web Service?
    ... Each entry in the collection has a unique URI formed by appending the ... The current Visual Studio does not support adding a Web Reference to REST ... REST based Web Service, we could implement the client on top of the WCF ...
    (microsoft.public.dotnet.distributed_apps)
  • SoapException: unable to generate temporary class
    ... I have a Biztalk assembly that has been working great in my dev environment. ... the Web Service Publishing Wizard with great success. ... ping the WSDL on my production W2K3 server. ...
    (microsoft.public.biztalk.general)
  • Re: repost: Help with error "80070005"
    ... Have you tried running the SDK web service samples on your environment. ... The Messaging Engine failed to retrieve the configuration from the database. ...
    (microsoft.public.biztalk.general)
  • Re: Conditional Web Service instantiation
    ... Each environment has its own db and web servers and its own web ... environment I hate to change the URL for the web service, ... Finally, if you are using .NET 2.0, then I've heard that using the new Settings architecture will resolve this problem for you. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: RMM web service & web server(s)
    ... as a Enterprise ARchive for deployment under WAS. ... It requires a Java run-time and the WAS environment to get to the web service. ... I would not expect anyone to purchase WAS for the sole purpose of hosting our web service. ... Search the archives at http://bama.ua.edu/archives/ibm-main.html ...
    (bit.listserv.ibm-main)