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.
I've downloaded the entire OGC schema files and placed them into my "D:/temp/OGCSchemas/" Directory.
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']
I believe this error is telling me to include more xsds in my command line.
So my question is: How do i determine which xsds to include in my command line?
I thought i'd included a *.xsd for every directory that it was including from, but obviously not.
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.
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:
But the code that it generates is way to small: