How to determine what schema files (xsd) to include on my svcutil command line?

自闭症网瘾萝莉.ら 提交于 2019-12-05 14:28:30

Not sure if this was the right way to go about it, but i created a program that would go through the schema and create my command line for me by following all "xs:import", "wsdl:import", "xsd:include", "xsd:import", and "include" xml elements recursively.

I ended up with the following command line which finally got generating code. But the code is way to small. Something is still wrong. But at least i was able to determine what files to include in the command line.

command line:

svcutil D:\temp\OGCSchemas\csw\2.0.2\http-binding.wsdl D:\temp\OGCSchemas\csw\2.0.2\xml-interfaces.wsdl D:\temp\OGCSchemas\csw\2.0.2\responses.wsdl D:\temp\OGCSchemas\csw\2.0.2\CSW-discovery.xsd D:\temp\OGCSchemas\csw\2.0.2\CSW-publication.xsd D:\temp\OGCSchemas\ows\1.0.0\owsExceptionReport.xsd D:\temp\OGCSchemas\csw\2.0.2\record.xsd D:\temp\OGCSchemas\ows\1.0.0\owsAll.xsd D:\temp\OGCSchemas\filter\1.1.0\filter.xsd D:\temp\OGCSchemas\csw\2.0.2\rec-dcterms.xsd D:\temp\OGCSchemas\csw\2.0.2\rec-dcmes.xsd D:\temp\OGCSchemas\ows\1.0.0\owsGetCapabilities.xsd D:\temp\OGCSchemas\filter\1.1.0\expr.xsd D:\temp\OGCSchemas\filter\1.1.0\sort.xsd D:\temp\OGCSchemas\filter\1.1.0\filterCapabilities.xsd D:\temp\OGCSchemas\gml\3.1.1\base\geometryAggregates.xsd D:\temp\OGCSchemas\ows\1.0.0\owsServiceIdentification.xsd D:\temp\OGCSchemas\ows\1.0.0\owsServiceProvider.xsd D:\temp\OGCSchemas\ows\1.0.0\owsOperationsMetadata.xsd D:\temp\OGCSchemas\gml\3.1.1\base\geometryPrimitives.xsd D:\temp\OGCSchemas\ows\1.0.0\owsDataIdentification.xsd D:\temp\OGCSchemas\ows\1.0.0\ows19115subset.xsd D:\temp\OGCSchemas\ows\1.0.0\owsCommon.xsd D:\temp\OGCSchemas\gml\3.1.1\base\geometryBasic2d.xsd D:\temp\OGCSchemas\gml\3.1.1\base\geometryBasic0d1d.xsd D:\temp\OGCSchemas\gml\3.1.1\base\measures.xsd D:\temp\OGCSchemas\gml\3.1.1\base\units.xsd D:\temp\OGCSchemas\gml\3.1.1\base\dictionary.xsd D:\temp\OGCSchemas\gml\3.1.1\base\gmlBase.xsd D:\temp\OGCSchemas\gml\3.1.1\base\basicTypes.xsd D:\temp\OGCSchemas\xlink\1.0.0\xlinks.xsd /out:D:\temp\ogc.csw.proxy.cs

But the code that it generates is way to small:

[assembly: System.Runtime.Serialization.ContractNamespaceAttribute("http://www.opengis.net/ows", ClrNamespace="www.opengis.net.ows")]
namespace www.opengis.net.ows
{
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Xml.Serialization.XmlSchemaProviderAttribute("ExportSchema")]
    [System.Xml.Serialization.XmlRootAttribute(IsNullable=false)]
    public partial class ExceptionReport : object, System.Xml.Serialization.IXmlSerializable
    {
        private System.Xml.XmlNode[] nodesField;
        private static System.Xml.XmlQualifiedName typeName = new System.Xml.XmlQualifiedName("ExceptionReport", "http://www.opengis.net/ows");
        public System.Xml.XmlNode[] Nodes
        {
            get
            {
                return this.nodesField;
            }
            set
            {
                this.nodesField = value;
            }
        }
        public void ReadXml(System.Xml.XmlReader reader)
        {
            this.nodesField = System.Runtime.Serialization.XmlSerializableServices.ReadNodes(reader);
        }

        public void WriteXml(System.Xml.XmlWriter writer)
        {
            System.Runtime.Serialization.XmlSerializableServices.WriteNodes(writer, this.Nodes);
        }

        public System.Xml.Schema.XmlSchema GetSchema()
        {
            return null;
        }
        public static System.Xml.XmlQualifiedName ExportSchema(System.Xml.Schema.XmlSchemaSet schemas)
        {
            System.Runtime.Serialization.XmlSerializableServices.AddDefaultSchema(schemas, typeName);
            return typeName;
        }
    }
}

I dealt with this the other day. The easiest way is to set them up in IIS and modify your hosts file to point those addresses to your localhost. Then use XSD on the main wsdl file and all will be good.

I'm sure there is a better way but after a few hours that is what I ended up doing.

you can try to modify the namespaces, but that didn't work for me plus you';d have to modify them for all files and thats such a pain.

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