Simple but very useful when the production server was going bonkers a couple of months ago.
In the old days of .Net 2.0, to change the URI of a web service proxy, you just set the "Url" property, re-set the credentials if you use them and call the method. Now with WCF, I have defined all the bindings in my configuration file, in the SOAP client's EndPoint I set the "Address" property with the URI of my server and I'm done! I don't even need to re-set the credentials that .Net 2.0 used to "forget" when I changed the URL of the proxy.
MyServiceSoapClient securitySoapClient = new MyServiceSoapClient();
for(int i=0; i<list.Count; i++)
{
mySoapClient.Endpoint.Address = new EndpointAddress(myServiceUri[list[i].Uri]);
//Call the service here
}
No comments:
Post a Comment