private static string m_url = "http://localhost/webservices.myapp/";Also, I don't understand this at all:
// What is MyApp a reference to? What is PersonnelWS? And the .Personnel is a class in the WS? 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);>>I completely don't understand this. I get the idea of a factory, but I don't understand the code.
>>>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; >>> } >>> } >>>>>>
>>>// 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); >>>>>>