Matthias,

yes this is absoultely possible. Even with the built-in functionality of
the automatically generated proxy class. There is a property Url which
you can set after proxy creation and instantiation.
An even better solution is to specifiy that the URL should be stored in
a config file and be read from there dynamically. This behavior can be
achieved with wsdl.exe or through VS.NET's property pane:

wsdl.exe http://localhost/sample.asmx?WSDL /l:CS /appsettingurlkey:MyWSUrl
(in a single line)

This is code from the generated proxy class:

public MyWebService()
{
  string urlSetting =
System.Configuration.ConfigurationSettings.AppSettings["MyWSUrl"];
  if ((urlSetting != null))
  {
   this.Url = urlSetting;
  }
  else
  {
   this.Url = "http://localhost/MyWS.asmx";;
  }
}

And a corresponding web.config file:

<?xml version="1.0" encoding="utf-8" ?>
  <configuration>
    <appSettings>
     <add key="MyWSUrl"
      value="http://www.eyesoft.de/ws/MyWS.asmx";
     />
   </appSettings>
  </configuration>

HTH.

Cheers,
Christian
---------------------------------
  .NET XML Web Services Repertory
   http://www.xmlwebservices.cc/
---------------------------------


Mattias Konradsson wrote:
> Hmm, ok what I'm trying to do is an application interface for some
> webservices which is easy enough. The problem is that you should be able to
> set up
> the application to use the webservice with the location of your choice, and
> then I can't use proxy objecs for that service since it compiles with a
> fixed url, am I overlooking some simple solution to my problem here?

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to