public static WebService[] GetServices(string url) { ArrayList services = new ArrayList(); Assembly assembly = CustomProxyGenerator.CreateAssembly(url); foreach (Type type in assembly.GetTypes()) { if (!type.IsSubclassOf(typeof(SoapHttpClientProtocol))) { continue; } SoapHttpClientProtocol svc = Activator.CreateInstance(type) as SoapHttpClientProtocol; if (url.ToLower().EndsWith("?wsdl")) { svc.Url = url.Substring(0, url.Length - 5); } services.Add(new WebService(svc)); } services.Sort(); return(services.ToArray(typeof(WebService)) as WebService[]); }
private void InitializeMethods() { ArrayList list = new ArrayList(); Type type = _svc.GetType(); foreach (MethodInfo method in type.GetMethods( BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.Instance)) { if (CustomProxyGenerator.IsAsyncMethod(method.Name)) { continue; } if (method.Name.StartsWith("get_") || method.Name.StartsWith("set_")) { continue; } list.Add(new WebMethod(_svc, method)); } list.Sort(); _methods = list.ToArray(typeof(WebMethod)) as WebMethod[]; }
internal WebMethod(SoapHttpClientProtocol svc, MethodInfo methodInfo) { _svc = svc; _methodInfo = methodInfo; string argType = CustomProxyGenerator.GetMethodArgType(methodInfo.Name); _arg = Activator.CreateInstance(svc.GetType().Assembly.GetType(argType)); }