Axis Plugin

The wsdl2java plugin uses the wsdl2java tasks of the axis distribution. Currently, it only supports the generation of .java files from .wsdl definitions. Future versions of it will support the generation of .wsdl definitions from .java files as well.

In order to generate Java from wsdl definitions add the following preGoal directive into the project's maven.xml file:

<preGoal name="java:compile">
  <attainGoal name="axis:compile" />
</preGoal>
        

Examples

Basic

The basic example illustrates how to use this plugin to deploy an axis service to localhost. It is assumed that a server (e.g. Tomcat) with Axis is installed and verified to be working.

Dependencies in your project.xml file:

            
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis</artifactId>
      <version>1.2-RC2</version>
    </dependency>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis-jaxrpc</artifactId>
      <version>1.2-RC2</version>
    </dependency>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis-wsdl4j</artifactId>
      <version>1.2-RC2</version>
    </dependency>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis-saaj</artifactId>
      <version>1.2-RC2</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.8</version>
      <properties>
        <dependencyType>lib</dependencyType>
      </properties>
    </dependency>
            
          

Given that you already ran axis:wsdl2java and moved YourImplClass.java into your src tree you would need the following properties in project.properties.

            
# axis settings
maven.axis.excludes=*/**/YourImplClass.java
maven.axis.copy.deploy=true
maven.axis.home=/opt/jakarta-tomcat-5.5.4/webapps/axis
maven.axis.wsdd.deploy=${maven.axis.generated.dir}/org/web/service/deploy.wsdd
maven.axis.wsdd.undeploy=${maven.axis.generated.dir}/org/web/service/undeploy.wsdd
            
          

Finally, your maven.xml file needs to be adjusted to run axis:compile prior to java:compile.

            
  <preGoal name="java:compile">
    <attainGoal name="axis:compile" />
  </preGoal>
            
          

This setup generates the .java files from all WebService description (.wsdl files) in the default location src/wsdl. Further these generated files are compiled. In this example the */**/YourImplClass.java is excluded from the compilation step in order to prevent interference with the modified one in src/java.

After running maven jar you can deploy your WebService with maven axis:deploy. This goal performs two steps. First it copies your component jar and all dependencies with the property dependencyType set to lib in ${maven.axis.home>/WEB-INF/lib folder. Second, it runs the axis-admin task to deploy the ${maven.axis.home>WebService with the ${maven.axis.home>${maven.axis.generated.dir}/org/web/service/deploy.wsdd file.

Advanced

This example illustrates how to use this plugin to create a self-contained .war-file which then can be deployed. Note: the content of the web.xml file from axis has to be copied into the component-specific web.xml file.

Dependencies in your project.xml file:

            
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis</artifactId>
      <version>1.2-RC2</version>
      <properties>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis-jaxrpc</artifactId>
      <version>1.2-RC2</version>
      <properties>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis-wsdl4j</artifactId>
      <version>1.2-RC2</version>
      <properties>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis-saaj</artifactId>
      <version>1.2-RC2</version>
      <properties>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.8</version>
      <properties>
        <dependencyType>lib</dependencyType>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>
    <dependency>
      <groupId>xerces</groupId>
      <artifactId>xerces</artifactId>
      <version>2.4.0</version>
      <properties>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>
    <dependency>
      <groupId>xml-apis</groupId>
      <artifactId>xml-apis</artifactId>
      <version>2.0.2</version>
      <properties>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>
    <dependency>
      <groupId>xerces</groupId>
      <artifactId>xercesImpl</artifactId>
      <version>2.4.0</version>
      <properties>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.0.3</version>
      <properties>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>
    <dependency>
      <groupId>commons-discovery</groupId>
      <artifactId>commons-discovery</artifactId>
      <version>0.2</version>
      <properties>
        <war.bundle>true</war.bundle>
      </properties>
    </dependency>
            
          

Since we do not deploy via file-copy as in the basic example we remove two properties, maven.axis.copy.deploy and maven.axis.home. Instead we specify the admin url of axis in your web application.

            
# axis settings
maven.axis.excludes=*/**/YourImplClass.java
maven.axis.admin.url=http://localhost:8080/yourAppContext/AdminService?wsdl
maven.axis.wsdd.deploy=${maven.axis.generated.dir}/org/web/service/deploy.wsdd
maven.axis.wsdd.undeploy=${maven.axis.generated.dir}/org/web/service/undeploy.wsdd
            
          

maven.xml:

            
  <preGoal name="java:compile">
    <attainGoal name="axis:compile" />
  </preGoal>
            
          

This setup creates a self-contained .war-file using the maven-war-plugin which can then be deployed as a standalone application into the server.