Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have succeeded in the same process. The aim is to create a web service proxy JAR for the web services in our application. </p> <h2>Web services</h2> <p>We have three web services in our application (currently). They are created by a Maven project that builds a WAR with the service and supporting classes, that contains a <code>sun-jaxws.xml</code> descriptor as well as <code>web.xml</code>.</p> <p>The web-service Maven project is part of a multi-project build so the web-service WAR is one module in an EAR that also has an EJB JAR, user-interface WAR and other JARs (as well as dependencies).</p> <h2>Client proxy JAR</h2> <p>Ideally, I would create the client proxy JAR in another Maven project that depends on the web service WAR project and uses the Maven JAX-WS plugin goals <code>wsgen</code> followed by <code>wsimport</code> to do the work.</p> <p>But I could not get a Maven project to use a WAR as a depedency so that its classes (in <code>WEB-INF/classes</code>) are added to the class path. I tried the <a href="http://static.appfuse.org/maven-warpath-plugin/index.html" rel="nofollow">AppFuse Warpath plugin</a> but could not get it to unpack the WAR dependency.</p> <h2>Two artifacts from one Maven project</h2> <p>In the end I had to resort to building and installing multiple artifacts in one Maven project. My findings about <code>wsgen</code> and <code>wsimport</code> and the second artifact:</p> <ul> <li><code>jaxws-maven-plugin</code> needs its own dependencies for the <code>wsgen</code> goal if they are outside the current project, otherwise it can’t find them. (Even if <code>verbose</code> is set <code>true</code> this goal emits little helpful information.)</li> <li>The <code>wsgen</code> goal must be called for each service to generate a WSDL.</li> <li>The <code>wsimport</code> goal is called once for on all WSDLs at once because the services share a number of support classes. (Because all generated classes go into one client proxy package, it is important to have no overlap of class names across the original sources, even if they originate in different packages.)</li> <li><code>maven-jar-plugin:jar</code> and <code>maven-install-plugin:install-file</code> are called to package and install the client proxy JAR.</li> </ul> <p>Below are key parts of the POM with some comments:</p> <pre><code>&lt;parent&gt; &lt;groupId&gt;lighthouse.navigate&lt;/groupId&gt; &lt;artifactId&gt;navigate&lt;/artifactId&gt; &lt;version&gt;3.9.0-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;artifactId&gt;navigate-webservice&lt;/artifactId&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;name&gt;Navigate WebService&lt;/name&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;${project.groupId}&lt;/groupId&gt; &lt;artifactId&gt;navigate-util&lt;/artifactId&gt; &lt;version&gt;${project.version}&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;!-- snip --&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.jvnet.jax-ws-commons&lt;/groupId&gt; &lt;artifactId&gt;jaxws-maven-plugin&lt;/artifactId&gt; &lt;version&gt;2.2&lt;/version&gt; &lt;executions&gt; &lt;!-- WSDLs must be generated for each service. --&gt; &lt;execution&gt; &lt;id&gt;generate-client-wsdl&lt;/id&gt; &lt;phase&gt;process-classes&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;wsgen&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;sei&gt;nav.ws.client.ClientWebService&lt;/sei&gt; &lt;genWsdl&gt;true&lt;/genWsdl&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;generate-licence-wsdl&lt;/id&gt; &lt;phase&gt;process-classes&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;wsgen&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;sei&gt;nav.ws.licence.LicenceWebService&lt;/sei&gt; &lt;genWsdl&gt;true&lt;/genWsdl&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;!-- snip --&gt; &lt;!-- Single generation of client proxy because WSDLs share classes. --&gt; &lt;execution&gt; &lt;id&gt;generate-proxies&lt;/id&gt; &lt;phase&gt;process-classes&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;wsimport&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;wsdlDirectory&gt;target/generated-sources/wsdl&lt;/wsdlDirectory&gt; &lt;destDir&gt;target/wsgen/classes&lt;/destDir&gt; &lt;packageName&gt;nav.ws.proxy&lt;/packageName&gt; &lt;xnocompile&gt;false&lt;/xnocompile&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;!-- NB: wsgen needs its own dependencies declared so it can find classes outside this project. --&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;${project.groupId}&lt;/groupId&gt; &lt;artifactId&gt;navigate-util&lt;/artifactId&gt; &lt;version&gt;${project.version}&lt;/version&gt; &lt;/dependency&gt; &lt;!-- snip --&gt; &lt;/dependencies&gt; &lt;/plugin&gt; &lt;!-- Package client proxy JAR as secondary artifact. --&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt; &lt;version&gt;2.3.2&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;package-wsclient&lt;/id&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;jar&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;classesDirectory&gt;target/wsgen/classes&lt;/classesDirectory&gt; &lt;finalName&gt;navigate-wsclient-${project.version}&lt;/finalName&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;!-- Install client proxy JAR as secondary artifact. --&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-install-plugin&lt;/artifactId&gt; &lt;version&gt;2.4&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;install-wsclient&lt;/id&gt; &lt;phase&gt;install&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;install-file&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;file&gt;target/navigate-wsclient-${project.version}.jar&lt;/file&gt; &lt;groupId&gt;${project.groupId}&lt;/groupId&gt; &lt;artifactId&gt;navigate-wsclient&lt;/artifactId&gt; &lt;version&gt;${project.version}&lt;/version&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; </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. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    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