Reply to comment

Making a webservice client in dot-net configurable

By default, when you create a soap client in dotnet, the endpoint of your client is hardcoded as part of the dotnet dll.  Yes, I know that there is the *.dll.config file in the bin directory that contains the endpoint, but changing these does nothing.  Even if you do reload the app by touching the web.config.  It's just a tease.
If you want to make your web service client configurable so that you an use the same client code dll as you do in test as in production, you need to change the constructor in your dot net client service.  You will have to do this anytime you refresh your client code from the wsdl.  Anytime I do a "Update Web Reference", I lose my  changes, so I just plug them back in.
http://dmidev.r-effects.com:8080/dmi/services/DMIService?wsdl
///
public YourClientService() {
this.Url = "http://localhost:8080/yourapp/services/YourService?wsdl"
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options