title: CXF: Attaching xsd schemes to make WSDL
body: <p>I'm developing a web-service in some kind of contract-first terms - firstly, I create xsd schemes, secondly, generate classes with JAXB upon them, and then, I want to attach these schemes to WSDL. Here is my applicationContext,xml: </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;jaxws:endpoint id="webService" 
                  implementor="#wsImplementer" 
                  address="/service"&gt;
  
     &lt;jaxws:schemaLocations&gt;
         &lt;jaxws:schemaLocation&gt;classpath:/xsd/RequestWrapper.xsd&lt;/jaxws:schemaLocation&gt;
      &lt;/jaxws:schemaLocations&gt;
  
  &lt;/jaxws:endpoint&gt;
  </code></pre>
  
  <p>The problem is: the RequestWrapper.xsd contains <code>&lt;xs:include schemaLocation="ComplexTypes.xsd"/&gt;</code> and the 
  ComplexTypes.xsd contains <code>&lt;xs:include schemaLocation="SimpleTypes.xsd"/&gt;</code>. So, when CXF generates the WSDL, it contains the RequestWrapper.xsd scheme with such an include <code>http://service/path?xsd=ComplexTypes.xsd</code> which is ok, but if you walk to this link you'll see ComplexTypes.xsd with <code>&lt;xs:include schemaLocation="SimpleTypes.xsd"/&gt;</code>. Of course, this is not a valid WSDL cause it cannot load the SimpleTypes.xsd. </p>
  
  <p>I've managed to find the workaround: </p>
  
  <p>1) create a new scheme which consists of includes: </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; 
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         targetNamespace="http://custom/data"
         xmlns="http://custom/data"&gt;
  
  &lt;xs:include schemaLocation="SimpleTypes.xsd"/&gt;
  &lt;xs:include schemaLocation="ComplexTypes.xsd"/&gt;
  &lt;xs:include schemaLocation="RequestWrapper.xsd"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>2) delete all the includes from the other schemes.</p>
  
  <p>3) </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;jaxws:schemaLocations&gt;
         &lt;jaxws:schemaLocation&gt;classpath:/xsd/comprise.xsd&lt;/jaxws:schemaLocation&gt;
  &lt;/jaxws:schemaLocations&gt; 
  </code></pre>
  
  <p>That worked for me, but, as you can see, all the schemes are not valid (there is no includes). That looks really dull to comment includes all the time before exposing a web service. Can anybody please help me? How to go through this?   </p>
  
  <p>So that, I need some kind of scheme location resolver...</p>