views:

1385

answers:

1

I try to use axis2 (1.5.1) version to generate java codes from wsdl files, but I can't figure out what is the correct pom.xml

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.5.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                    <configuration>
                        <wsdlFile>src/main/resources/wsdl/stockquote.wsdl</wsdlFile>
                        <databindingName>xmlbeans</databindingName>
                        <packageName>a.bc</packageName>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2</artifactId>
        <version>1.5.1</version>
    </dependency>
</dependencies>

when I type mvn compile, it complains the

Retrieving document at 'src/main/resources/wsdl/stockquote.wsdl'.
java.lang.ClassNotFoundException: org.apache.xml.serializer.TreeWalker

And if i try to find the TreeWalker, it is a mess to find a suitable jar files.

can u someone give me a hints ? or give me correct pom.xml

[update] the xalan-2.7.0.jar needs be depedent as well, and the jar file is broken ( due to nexus problem), thx pascal

+2  A: 

It's maybe not optimal but the following pom.xml seems to allow the generated code to be compiled:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.stackoverflow</groupId>
  <artifactId>Q2888422</artifactId>
  <version>1.0-SNAPSHOT</version>
  ...
  <dependencies>
    <dependency>
      <groupId>org.apache.axis2</groupId>
      <artifactId>axis2</artifactId>
      <version>1.5.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.ws.commons.axiom</groupId>
      <artifactId>axiom-api</artifactId>
      <version>1.2.6</version>
    </dependency>
    <dependency>
      <groupId>org.apache.ws.commons.axiom</groupId>
      <artifactId>axiom-impl</artifactId>
      <version>1.2.6</version>
    </dependency>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis-wsdl4j</artifactId>
      <version>1.5.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.xmlbeans</groupId>
      <artifactId>xmlbeans</artifactId>
      <version>2.3.0</version>
    </dependency>
    ...
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
        <version>1.5.1</version>
        <executions>
          <execution>
            <goals>
              <goal>wsdl2code</goal>
            </goals>
            <configuration>
              <wsdlFile>src/main/resources/wsdl/stockquote.wsdl</wsdlFile>
              <databindingName>xmlbeans</databindingName>
              <packageName>a.bc</packageName>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

This pom.xml is the result or try and error plus some googling, I couldn't find a single official or unofficial resource with a working setup. Seriously, why the hell is it so hard to setup an Axis2 project? One more reason I don't like Axis.

Pascal Thivent
thank for the comments, and I use the new dep.The error still exists, because the dependance xercesImpl-2.6.2 doesn't have TreeWalker class, only the later version includes this.And I list all the maven dependencies version below (from my eclipse)axis2-1.5.1.jaraxiom-api-1.2.6.jargeronimo-activation_1.1_spec-1.0.jargeronimo-javamail_1.4_spec-1.2.jarcommons-logging-1.1.1.jarjaxen-1.1.1.jarxml-apis-1.3.04.jarxercesImpl-2.6.2.jargeronimo-stax-api_1.0_spec-1.0.1.jaraxiom-impl-1.2.6.jarwstx-asl-3.2.4.jaraxis-wsdl4j-1.5.1.jarxmlbeans-2.3.0.jarstax-api-1.0.1.jar
larrycai
Ok, it needs depend on xalan and my xalan-2.7.0 is broken again. now the problem is solved, thx.
larrycai
This got me on the right path but I had to update the axiom versions to 1.2.8 and also add a dependency on axiom-dom to get it compiling. Thanks for ending a morning of frustration!
Donal Boyle