如何确定什么模式文件(XSD),包括对我的SvcUtil工具命令行?我的、命令行、模式、文件

2023-09-03 20:41:45 作者:魔法少女猪壮壮

使用SvcUtil工具,我想生成一个代理类的的这符合 OGC CSW 2.0.2 Web服务端点(07-006r1)标准目录服务。

Using svcutil, I'm trying to generate a proxy class for a web service endpoint which follows the OGC CSW 2.0.2 (07-006r1) standard for catalog services.

我已经下载了整个OGC架构文件并把他们变成我的D:/温度/ OGCSchemas /目录。

I've downloaded the entire OGC schema files and placed them into my "D:/temp/OGCSchemas/" Directory.

我很感兴趣的模式是CSW,但CSW模式包括进口等模式,这就是为什么我下载整个集合。

The schema i'm interested in is CSW, however CSW schema includes and imports other schemas and that's why i've downloaded the entire set.

例如,你会看到这样的事情:

For example you will see something like this:

<wsdl:import namespace="http://www.opengis.net/cat/csw/2.0.2/requests" location="./xml-interfaces.wsdl"/>
<xsd:schema targetNamespace="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="2.0.2">
    <xsd:include schemaLocation="../../csw/2.0.2/CSW-discovery.xsd"/>
    <xsd:include schemaLocation="../../csw/2.0.2/CSW-publication.xsd"/>
</xsd:schema>

我的命令行到目前为止是这样的:

My command line so far looks like:

svcutil D:\temp\OGCSchemas\csw\2.0.2\examples\wsdl\2.0.2\*.wsdl D:\temp\OGCSchemas\csw\2.0.2\*.xsd D:\temp\OGCSchemas\filter\1.1.0\*.xsd D:\temp\OGCSchemas\ows\1.0.0\*.xsd /out:D:\temp\ogc.csw.proxy.cs

不过,我理解的是这样的许多错误:

But I'm getting many errors that look like this:

Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://www.opengis.net/cat/csw/2.0.2/soap']/wsdl:binding[@name='csw-SO
AP']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.opengis.net/cat/csw/2.0.2/wsdl']/wsdl:service[@name='CSW']/
wsdl:port[@name='csw-SOAP-Port']

我相信这个错误是告诉我,包括我的命令行更多的XSD。

I believe this error is telling me to include more xsds in my command line.

所以我的问题是:如何确定哪些的XSD在我的命令行,包括

我想我应该包括*的.xsd为每一个它包括目录,但显然不是。

I thought i'd included a *.xsd for every directory that it was including from, but obviously not.

编辑#1 什么是包括XSD文件时的规则?必须在进口或包含的所有文件被添加?有了这么大的架构,我想我要去需要建立一个工具来找到他们。

EDIT #1 What are the rules when including xsd files? Must all files that are imported or included be added? With such a big schema, I'm thinking i'm going to need to build a tool to find them all.

推荐答案

不知道这是正确的方式去了解它,但我创建了一个程序,将通过该模式,创造我的命令行,我按照所有XS:进口,WSDL:进口,XSD:包括,XSD:进口和包括XML元素递归。

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.

我结束了,最终产生了code以下命令行。但是,code是这样小。东西仍然是错误的。但至少我能确定哪些文件在命令行中包含。

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.

命令行:

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

不过,code,它产生的方式小:

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;
        }
    }
}