Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I finally figured out the right answer to this question today.</p> <pre class="lang-xml prettyprint-override"><code>&lt;plugin&gt; &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt; &lt;artifactId&gt;cxf-codegen-plugin&lt;/artifactId&gt; &lt;version&gt;${cxf.version}&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;generate-sources&lt;/id&gt; &lt;phase&gt;generate-sources&lt;/phase&gt; &lt;configuration&gt; &lt;sourceRoot&gt;${project.build.directory}/generated-sources/cxf&lt;/sourceRoot&gt; &lt;wsdlOptions&gt; &lt;wsdlOption&gt; &lt;wsdl&gt;${project.basedir}/src/main/resources/wsdl/FooService.wsdl&lt;/wsdl&gt; &lt;wsdlLocation&gt;classpath:wsdl/FooService.wsdl&lt;/wsdlLocation&gt; &lt;/wsdlOption&gt; &lt;/wsdlOptions&gt; &lt;/configuration&gt; &lt;goals&gt; &lt;goal&gt;wsdl2java&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>Notice that I have prefixed the value in <code>wsdlLocation</code> with <code>classpath:</code>. This tells the plugin that the wsdl will be on the classpath instead of an absolute path. Then it will generate code similar to this:</p> <pre><code>@WebServiceClient(name = "FooService", wsdlLocation = "classpath:wsdl/FooService.wsdl", targetNamespace = "http://org/example/foo") public class Foo_Service extends Service { public final static URL WSDL_LOCATION; public final static QName SERVICE = new QName("http://org/example/foo", "Foo"); public final static QName FooSOAPOverHTTP = new QName("http://org/example/foo", "Foo_SOAPOverHTTP"); static { URL url = Foo_Service.class.getClassLoader().getResource("wsdl/FooService.wsdl"); if (url == null) { java.util.logging.Logger.getLogger(Foo_Service.class.getName()) .log(java.util.logging.Level.INFO, "Can not initialize the default wsdl from {0}", "classpath:wsdl/FooService.wsdl"); } WSDL_LOCATION = url; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload