Maven 2 axis2 maven示例

Maven 2 axis2 maven示例,maven-2,wsdl,axis2,xmlserializer,wsdl2code,Maven 2,Wsdl,Axis2,Xmlserializer,Wsdl2code,我尝试使用axis2(1.5.1)版本从wsdl文件生成java代码,但我不知道正确的pom.xml是什么 <build> <plugins> <plugin> <groupId>org.apache.axis2</groupId> <artifactId>axis2-wsdl2code-maven-plugin</artifactId>

我尝试使用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>
如果我试图找到TreeWalker,那么要找到合适的jar文件就太麻烦了

有人能给我一个提示吗?或者给我正确的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>

[更新]xalan-2.7.0.jar也需要依赖,jar文件已损坏(由于nexus问题),thx pascal可能不是最优的,但以下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>

4.0.0
com.stackoverflow
Q2888422
1.0-快照
...
org.apache.axis2
axis2
1.5.1
org.apache.ws.commons.axiom
axiom api
1.2.6
org.apache.ws.commons.axiom
简化公理
1.2.6
轴
axis-wsdl4j
1.5.1
org.apache.xmlbeans
xmlbeans
2.3.0
...
org.apache.axis2
axis2-wsdl2code-maven-plugin
1.5.1
wsdl2code
src/main/resources/wsdl/stockquote.wsdl
xmlbeans
a、 卑诗省

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

注意必须向上推配置(示例是错误的)


org.apache.axis2
axis2-wsdl2code-maven-plugin
1.5.1
src/main/resources/wsdl/stockquote.wsdl
xmlbeans
a、 卑诗省
wsdl2code

这是Pascal Thivent提供的pom的更新版本

主要的修改是版本名不同,需要neethi

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>my-wsdl2code-example</artifactId>
    <version>1.0</version>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
                <version>1.6.1</version>
                <executions>
                    <execution>
                        <id>execution_id</id>
                        <goals>
                            <goal>wsdl2code</goal>
                        </goals>
                        <configuration>
                            <packageName>com.example.wsdl</packageName>
                            <wsdlFile>src/main/wsdl/web-service.wsdl</wsdlFile>
                            <databindingName>xmlbeans</databindingName>
                        </configuration>
                    </execution>
                </executions>

                <dependencies>

                    <dependency>
                        <groupId>org.apache.xmlbeans</groupId>
                        <artifactId>xmlbeans</artifactId>
                        <version>2.6.0</version>
                    </dependency>

                </dependencies>
            </plugin>
        </plugins>
    </build>

    <dependencies>

        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2</artifactId>
            <version>1.6.1</version>
        </dependency>

        <dependency>
            <groupId>axis</groupId>
            <artifactId>axis-wsdl4j</artifactId>
            <version>1.5.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.neethi</groupId>
            <artifactId>neethi</artifactId>
            <version>3.0.2</version>
        </dependency>


        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-impl</artifactId>
            <version>1.2.14</version>
        </dependency>

        <dependency>
            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans</artifactId>
            <version>2.6.0</version>
        </dependency>

    </dependencies>

</project>

4.0.0
com.example
my-wsdl2code-example
1
org.apache.axis2
axis2-wsdl2code-maven-plugin
1.6.1
执行标识
wsdl2code
com.example.wsdl
src/main/wsdl/web-service.wsdl
xmlbeans
org.apache.xmlbeans
xmlbeans
2.6.0
org.apache.axis2
axis2
1.6.1
轴
axis-wsdl4j
1.5.1
org.apache.neethi
尼西
3.0.2
org.apache.ws.commons.axiom
简化公理
1.2.14
org.apache.xmlbeans
xmlbeans
2.6.0

多亏了Pascal的pom,我才能够在最新版本中实现这一点。此外:

  • 我必须添加
    buildhelpermaven插件
    插件,以便我的客户机类可以访问代理存根
  • 我删除了
    配置选项
  • 我更改了我的
    outputDirectory
这是我的pom:


4.0.0
com.yourcompany
axis2服务器代理
1.0.0
罐子
org.apache.axis2
axis2
1.6.3
org.apache.ws.commons.axiom
axiom api
1.2.15
org.apache.ws.commons.axiom
简化公理
1.2.15
轴
axis-wsdl4j
1.5.1
org.apache.xmlbeans
xmlbeans
2.6.0
org.apache.axis2
axis2-wsdl2code-maven-plugin
1.6.3
wsdl2code
目标/生成源/
src/main/wsdl/services\u visa\u com\u realtime\u realtimeservice\u v6\u PublicV2.wsdl
xmlbeans
org.codehaus.mojo
构建助手maven插件
添加源
生成源
添加源
${project.build.directory}/生成的源/

感谢您的评论,我使用了新的dep。错误仍然存在,因为Dependence xercesImpl-2.6.2没有TreeWalker类,只有更高版本包含此类。我在下面列出了所有maven依赖项版本(来自我的eclipse)1.1.1.1.1.1.1.1.1.1.1.1.1.6.6.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.6.6.6.6.6.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1啊,,它需要依靠xalan,我的xalan-2.7.0又坏了。现在问题解决了,thx。这让我走上了正确的道路,但我必须将axiom版本更新到1.2.8,并添加对axiom dom的依赖以使其编译。感谢你结束了一个受挫的早晨!在axis2 1.6.1中,还需要neethi:org.apach
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>my-wsdl2code-example</artifactId>
    <version>1.0</version>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
                <version>1.6.1</version>
                <executions>
                    <execution>
                        <id>execution_id</id>
                        <goals>
                            <goal>wsdl2code</goal>
                        </goals>
                        <configuration>
                            <packageName>com.example.wsdl</packageName>
                            <wsdlFile>src/main/wsdl/web-service.wsdl</wsdlFile>
                            <databindingName>xmlbeans</databindingName>
                        </configuration>
                    </execution>
                </executions>

                <dependencies>

                    <dependency>
                        <groupId>org.apache.xmlbeans</groupId>
                        <artifactId>xmlbeans</artifactId>
                        <version>2.6.0</version>
                    </dependency>

                </dependencies>
            </plugin>
        </plugins>
    </build>

    <dependencies>

        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2</artifactId>
            <version>1.6.1</version>
        </dependency>

        <dependency>
            <groupId>axis</groupId>
            <artifactId>axis-wsdl4j</artifactId>
            <version>1.5.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.neethi</groupId>
            <artifactId>neethi</artifactId>
            <version>3.0.2</version>
        </dependency>


        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-impl</artifactId>
            <version>1.2.14</version>
        </dependency>

        <dependency>
            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans</artifactId>
            <version>2.6.0</version>
        </dependency>

    </dependencies>

</project>