Example #1
0
 public Method(WebService parent, string name, Type returnType)
 {
     this._Parent = parent;
     this._Name = name;
     this._ReturnType = returnType;
     this._Parameters = new List<Parameter>();
 }
Example #2
0
 private void lstWebServices_SelectedIndexChanged(object sender, EventArgs e)
 {
     System.Windows.Forms.ListControl realSender = (System.Windows.Forms.ListControl)sender;
     string name = realSender.Text;
     WebService ws = null;
     foreach(WebService myWs in this._currentWsc.WebServices)
     {
         if (name.Equals(myWs.Name))
         {
             this._currentWs = myWs;
             this.lstMethods.Items.Clear();
             this.lstParameters.Items.Clear();
             foreach (Method m in myWs.Methods)
             {
                 lstMethods.Items.Add(m.Name);
             }
         }
     }
 }
Example #3
0
        public WebServiceCollection Enumerate()
        {
            //  Clear the cache every time.  If we are running this on a site we should
            //  be seeing everything for the first time (hence no cache benefit), and
            //  for development the cache just causes problems with changes not being
            //  recognized.
            try
            {
                DynamicWebServiceProxy.ClearCache(WSDL);
            }
            catch
            {
                //  The file handling in the DynWSLib cache is kind of strange, so this usually isn't a
                //  big problem.  Usually  :)  It often means that the DLL has already been loaded by this
                //  process and can't be unloaded.
            }

            StringBuilder text = new StringBuilder();

            DynamicProxy.EnableMessageAccess = true;
            DynamicProxy.Wsdl = WSDL;

            Type[] types = DynamicProxy.ProxyAssembly.GetTypes();

            foreach (Type t in types)
            {
                WebService currentWebService;

                if (t.BaseType == typeof(SoapHttpClientProtocolExtended))
                {
                    text.Append("Found a WebService: ");
                    text.Append(t.Name);
                    text.Append("\n");

                    // Services.WebServices.Add(new WebService(t.Name));
                    currentWebService = new WebService(Services, t.Name);
                    Services.WebServices.Add(currentWebService);

                    MethodInfo[] mi = t.GetMethods(BindingFlags.Public |
                                    BindingFlags.Instance |
                                    BindingFlags.DeclaredOnly);

                    foreach (MethodInfo m in mi)
                    {
                        if (!(m.Name.StartsWith("Begin") || m.Name.StartsWith("End")))
                        {
                            text.Append("Found a method: ");
                            text.Append(m.Name);
                            text.Append(" with return type: ");
                            text.Append(m.ReturnType);
                            text.Append("\n");

                            Method currentMethod = new Method(currentWebService, m.Name, m.ReturnType);
                            currentWebService.Methods.Add(currentMethod);

                            ParameterInfo[] pi = m.GetParameters();
                            // paramInfo = pi;

                            foreach (ParameterInfo p in pi)
                            {
                                text.Append("Found a parameter: ");
                                text.Append(p.Name);
                                text.Append(":");
                                text.Append(p.ParameterType);
                                text.Append("\n");

                                Parameter currentParameter;
                                currentParameter = new Parameter(p.Name, p.ParameterType);
                                currentMethod.Parameters.Add(currentParameter);
                            }
                        }
                    }
                }
                else
                {
                    text.Append("Found non-standard Type: ");
                    text.Append(t.Name);
                    text.Append("\n");
                }
            }

            //  TODO - Make this have no return value and use the WebServicesCollection.ToString instead.
            System.Console.WriteLine(text.ToString());
            // return (text.ToString());
            return (_Services);
        }