Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change 
notification.

The following page has been changed by CyrilleLeClerc:
http://wiki.apache.org/ws/FrontPage/Axis/MavenIntegration

The comment on the change is:
Sample of Axis wsdl2java integration in a Maven 2 project

New page:
= Using Axis wsdl2java Ant task in a Maven 2 project =

A [http://mojo.codehaus.org/axistools-maven-plugin/ Maven Axis Tools Plugin] 
for [http://maven.apache.org/ Maven 2] in under development at 
[http://www.codehaus.org/ Codehaus] but it may not yet fit all your needs (as 
of may 2006). Here is a sample using 
[http://ws.apache.org/axis/java/ant/ant.html Axis Ant tasks] to perform a 
wsdl2java webservice creation. This sample performs both java code generation 
and web service declaration in Axis' configuration (server-config.wsdd).

Here are the tasks performed during the different Maven build cycle's phases :

 A. '''generate-source''' phase:
  1. Run '''wsdl2java '''
  1. Delete the generated service implementation class from the 
generated-source folder (ie {{{/target/generated-source/main/java}}} ) because 
it is already defined in the source folder (ie {{{/src/main/java}}} )
 A. '''process-classes''' phase:
  1. '''Deploy''' the generated webservice in Axis' configuration file (ie 
{{{src/main/webapp/WEB-INF/server-config.wsdd}}}). (!) Note that this task 
requires the code to be compiled ; this is the reason why it is called in the 
process-classes phase and not the generate-sources one

Extract of a Maven2 '''pom.xml''':

{{{
<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
    <execution>
      <id>wsdl2java</id>
      <phase>generate-sources</phase>
      <configuration>
        <tasks>
          <!-- create source folder -->
          <mkdir dir="target/generated-sources/main/java" />

          <!-- declare ant task -->
          <taskdef
            resource="axis-tasks.properties"
            classpathref="maven.compile.classpath" />

          <!-- run wsdl2java -->
          <axis-wsdl2java
            output="target/generated-sources/main/java"
            deployScope="Application" serverSide="true"
            testcase="true" url="src/main/wsdl/helloWorld.wsdl" />
          
          <!--
          Delete server side implementation from 
/target/generated-sources/main/java/
          because this class is defined in /src/main/java
          -->
          <delete 
file="target/generated-sources/main/java/com/mycompany/ws/HelloWorldBindingImpl.java"
 />

        </tasks>
        
        <!--
        add "generated-sources" folders to the compile path
        -->
        <sourceRoot>target/generated-sources/main/java</sourceRoot>
        <testSourceRoot>target/generated-sources/test/java</testSourceRoot>

      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>

    <execution>
      <!--
      update axis' configuration file (server-config.wsdd) requires that the 
java 
      files are compiled thus, perform this task in the "process-classes" phase
      -->
      <id>Update server-config.wsdd</id>
      <phase>process-classes</phase>
      <configuration>
        <tasks>
          <!-- update src/main/webapp/WEB-INF/server-config.wsdd -->
          <java
            classname="org.apache.axis.utils.Admin" fork="true"
            classpathref="maven.compile.classpath"
            dir="src/main/webapp/WEB-INF">
            <arg value="server" />
            <arg
              
value="${basedir}/target/generated-sources/main/java/com/mycompany/ws/deploy.wsdd"
 />
          </java>
        </tasks>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>

  </executions>
</plugin>
...
<dependencies>
  <dependency>
    <groupId>org.apache.axis</groupId>
    <artifactId>axis</artifactId>
    <version>1.3</version>
  </dependency>
  <dependency>
    <groupId>org.apache.axis</groupId>
    <artifactId>axis-ant</artifactId>
    <version>1.3</version>
  </dependency>
</dependencies>
}}}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to