public class WebServiceFactory { // the default URL private static string m_url = "http://localhost/webservices.myapp/"; public static SoapHttpClientProtocol GetWebService(SoapHttpClientProtocol ws) { string url = ws.Url.ToLower(); string newurl = this.MyMethodToGetURLFromConfig(); if (newurl.Length == 0 || newurl.ToLower().Trim() == m_url) { return ws; } else { ws.Url = url.Replace(m_url, newurl); return ws; } }And you use it like this:
// declaration private MyApp.PersonnelWS.Personnel oWS; // instantiation this.oWS = (MyApp.PersonnelWS.Personnel)WebServiceFactory.GetWebService(new MyApp.PersonnelWS.Personnel()); // use as any other class method call string XML = this.oWS.GetPersonnel(MyKey);~~Bonnie