axis2 maven示例

Lar*_*Cai 17 wsdl axis2 maven-2 wsdl2code xmlserializer

我尝试使用axis2(1.5.1)版本从wsdl文件生成java代码,但我无法弄清楚什么是正确的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>
Run Code Online (Sandbox Code Playgroud)

当我输入mvn编译时,它会抱怨

Retrieving document at 'src/main/resources/wsdl/stockquote.wsdl'.
java.lang.ClassNotFoundException: org.apache.xml.serializer.TreeWalker
Run Code Online (Sandbox Code Playgroud)

如果我试图找到TreeWalker,找到一个合适的jar文件是一团糟.

你有人能给我一些提示吗?或者给我正确的pom.xml

[更新] xalan-2.7.0.jar也需要依赖,并且jar文件被破坏(由于nexus问题),thx pascal

Pas*_*ent 22

它可能不是最佳的,但是下面的pom.xml似乎允许编译生成的代码:

<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>
Run Code Online (Sandbox Code Playgroud)

这个pom.xml是结果或尝试和错误加上一些谷歌搜索,我找不到一个工作设置的单一官方或非官方资源.说真的,为什么设置Axis2项目这么难?我不喜欢Axis的另一个原因.

  • 使用axis2 1.6.1,还需要neethi:<dependency> <groupId> org.apache.neethi </ groupId> <artifactId> neethi </ artifactId> <version> 3.0.1 </ version> <packaging> bundle </包装> </ dependency> (2认同)