Detailed ServiceDescription / Proxy from WSDL

若如初见. 提交于 2019-12-06 15:59:33

If anyone has a similar question, here is how I did it:

foreach (System.Xml.Schema.XmlSchemaComplexType item in xmlSchema.SchemaTypes.Values)
        {
            ComplexType cType = new ComplexType(item.Name);

            System.Xml.Schema.XmlSchemaContentModel model = item.ContentModel;
            System.Xml.Schema.XmlSchemaComplexContent complex = model as System.Xml.Schema.XmlSchemaComplexContent;

            if (complex != null)
            {
                System.Xml.Schema.XmlSchemaComplexContentExtension extension = complex.Content as System.Xml.Schema.XmlSchemaComplexContentExtension;
                System.Xml.Schema.XmlSchemaParticle particle = extension.Particle;
                System.Xml.Schema.XmlSchemaSequence sequence = particle as System.Xml.Schema.XmlSchemaSequence;

                if (sequence != null)
                {
                    List<SimpleType> primitives = new List<SimpleType>(); 

                    foreach (System.Xml.Schema.XmlSchemaElement childElement in sequence.Items)
                    {
                        string name = childElement.Name;
                        string type = childElement.SchemaTypeName.Name;
                        cType.Primitives.Add(new SimpleType(name, type));
                    }

                    if (cType.Name == parameter.Type || "ArrayOf" + cType.Name == parameter.Type)
                    {
                        descriptions.Add(new ComplexParameter(cType, item.Name));
                    }
                }
            }
        } 

This looks pretty similar to what you you did WebServiceInfo It returns custom objects with the info. (if I am understanding your question and the blog well enough)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!