MetadataSet GetMetadataSetFromWsdl(string path)
        {
            var ms = new MetadataSet();
            var sd = WSServiceDescription.Read(XmlReader.Create(path));

            ms.MetadataSections.Add(MetadataSection.CreateFromServiceDescription(sd));
            foreach (XmlSchema xs in sd.Types.Schemas)
            {
                foreach (XmlSchemaImport import in xs.Includes)
                {
                    using (var xr = XmlReader.Create(Path.Combine(Path.GetDirectoryName(path), import.SchemaLocation)))
                        ms.MetadataSections.Add(MetadataSection.CreateFromSchema(XmlSchema.Read(xr, null)));
                }
            }
            return(ms);
        }
        public void ImportXmlTypes()
        {
            // part of bug #670945
            var mset = new MetadataSet();
            WSServiceDescription sd = null;

            sd = WSServiceDescription.Read(XmlReader.Create("670945.wsdl"));
            mset.MetadataSections.Add(new MetadataSection()
            {
                Dialect  = MetadataSection.ServiceDescriptionDialect,
                Metadata = sd
            });

            var imp = new WsdlImporter(mset);
            var sec = imp.ImportAllContracts();

            // FIXME: examine resulting operations.
        }