views:

329

answers:

2

My particular use case is using the wsimport goal (which basically maps to the jaxws wsimport.sh tool) to generate java code from wsdl. Looking for ideas on how others have integrated this goal into their development cycle. ie. do you generate all the interfaces only once and check it in. Where do you store the actual wsdl and any xsd's ? in the src/resources or do you always generate against a remote url? I ask as the doc on the tool is pretty thin on the ground.

+3  A: 

Put the wsdl and xsd files in the src/main/wsdl folder and execute the wsimport goal during the generate-sources phase of the default lifecycle. I actually prefer the axistools-maven-plugin over the one from jax-ws and use the following configuration to generate my java files:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>axistools-maven-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>wsdl2java</goal>
      </goals>
    </execution>
  </executions>
</plugin>

As far as the whether to include them in your main project or not, use the same logic as for any other refactoring exercise ... if the wsdl and xsd files are used by more than one Maven project, then separate them from the projects using them and create (in essence) a Maven project that specifies the Web Service interface.

If you're willing to switch to the Axis library, there's a great tutorial section on building a web service as part of a J2EE project in the book "Better Builds with Maven", which is available as a free download at: http://www.mergere.com/better-build-maven.

Steve Moyer
http://www.mergere.com/better-build-maven requires username and password...
Neuquino
A: 

hey, great reference for the book. Maven rocks. Have only been using it the last month, but when you go back to an old project without it that's when you really miss it. The better-build-maven is a great link. FYI - we too had pulled the wsdl and interface generation into a seperate project/module and just include it as a dependency - since its a web service from a 3rd party its probably going to change (and we can then version the drops using maven also), and as you say it helps reuse amongst others projects.

nso1