- if (doc is ServiceDescription)\r
- descriptions.Add ((ServiceDescription)doc);\r
- else if (doc is XmlSchema)\r
- schemas.Add ((XmlSchema)doc);\r
+ DiscoveryClientProtocol dcc = CreateClient ();\r
+ dcc.AllowAutoRedirect = true;\r
+ \r
+ if (!url.StartsWith ("http://") && !url.StartsWith ("https://") && !url.StartsWith ("file://"))\r
+ url = new Uri (Path.GetFullPath (url)).ToString ();\r
+ \r
+ dcc.DiscoverAny (url);\r
+ dcc.ResolveAll ();\r
+ \r
+ foreach (object doc in dcc.Documents.Values)\r
+ {\r
+ if (doc is ServiceDescription)\r
+ descriptions.Add ((ServiceDescription)doc);\r
+ else if (doc is XmlSchema)\r
+ schemas.Add ((XmlSchema)doc);\r
+ }\r
+ \r
+ if (descriptions.Count == 0)\r
+ throw new Exception ("No WSDL document was found at the url " + url);\r
+ }\r
+ else\r
+ {\r
+ string[] names = className.Split (',');\r
+ if (names.Length != 2) throw new Exception ("Invalid parameter value for 'type'");\r
+ string cls = names[0].Trim ();\r
+ string assembly = names[1].Trim ();\r
+ \r
+ Assembly asm = Assembly.LoadFrom (assembly);\r
+ Type t = asm.GetType (cls);\r
+ if (t == null) throw new Exception ("Type '" + cls + "' not found in assembly " + assembly);\r
+ ServiceDescriptionReflector reflector = new ServiceDescriptionReflector ();\r
+ reflector.Reflect (t, url);\r
+ foreach (XmlSchema s in reflector.Schemas)\r
+ schemas.Add (s);\r
+ \r
+ foreach (ServiceDescription sd in reflector.ServiceDescriptions)\r
+ descriptions.Add (sd);\r