title: Bundling wsdl in jar with CXF wsdl2java
body: <p>I'm working on an implementation that will use a wsdl that I have gotten from a vendor. Our project is running on Spring and CXF, and I'd like to create a jar that will allow me to access this vendor's wsdl services, but I'm running into classpath issues.</p>
  
  <p>Using CXF's wsdl2java I am able to generate code that acts like this:</p>
  
  <pre><code>WSDL_LOCATION = new URL("file:SomeService.wsdl");
  </code></pre>
  
  <p>The service requires the wsdl to be in the classpath, but I would like to bundle it in the jar so that it is distributable as a stand-alone jar. Using the wsdl2java tool, I am able to specify the string in the URL instantiation to whatever I would like. However, I have not found a combination of a custom string and wsdl file location inside the jar that works.</p>
  
  <p>The only way I have gotten this to work as I want is to put the wsdl file in the same folder that the SomeService.class is and use the following line:</p>
  
  <pre><code>WSDL_LOCATION = TrackService.class.getResource("TrackService_v4.wsdl");
  </code></pre>
  
  <p>However, this has the downside of me having to manually edit the java code and compile it myself. This is undesirable because we would eventually like to make this process part of our maven build and have wsdl2java do the generation and compilation by itself automatically.</p>
  
  <p>I am OK with the wsdl being anywhere in the jar, but I don't know what to pass in to wsdl2java to have it reference a file inside the jar. </p>
  
  <p>Does anyone have any suggestions or experience doing this?</p>