标签: wsdl2code

axis2 maven示例

我尝试使用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

wsdl axis2 maven-2 wsdl2code xmlserializer

17
推荐指数
1
解决办法
5万
查看次数

使用带有Axis2 wsdl2code Maven插件的多个WSDL

我正在使用Maven2创建一个使用多个Web服务的客户端.我仅限于使用Axis2或支持Apache HttpClient作为HTTP管道的其他框架,因为这些服务需要与基于托管证书解决方案的集成集成HttpClient.

我熟悉CXF的代码生成Maven插件,允许在代码生成期间输入多个WSDL.但是,Axis2代码生成插件一次只能处理一个WSDL.

如何wsdl2code在代码生成阶段为每个WSDL 运行Maven ?我需要多个配置文件吗?

POM的构建部分如下所示:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.6.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <unpackClasses>true</unpackClasses>
                <databindingName>adb</databindingName>
                <packageName>org.example.stackoverflow.axis2-maven</packageName>
                <!-- only one of these actually gets used by code generator -->
                <wsdlFile>src/main/resources/service1.wsdl</wsdlFile>
                <wsdlFile>src/main/resources/service2.wsdl</wsdlFile>
                <outputDirectory>target/generated-sources</outputDirectory>
                <syncMode>sync</syncMode>
            </configuration>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

参考

java axis2 code-generation wsdl2code maven

16
推荐指数
1
解决办法
1万
查看次数

WSDL2Code(Maven)自动生成损坏的类(包)

我目前正在使用Axis2替换IBM WebService框架.从WSDL文件生成代码时,我使用Maven插件WSDL2Code.但是,创建的代码总是错误的.或者更确切地说,包名称总是错误的,这反过来使得每个方法都被称为不可调用(在eclipse中创建更多错误,高达10.000+错误).

这是一个实际发生的例子(这只是我专门为获得建议而做的一个例子):

      <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.4.1</version>
            <executions>
                <execution>
                    <id>Test</id>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                    <configuration>
                        <packageName>test.testpackage</packageName>
                        <databindingName>xmlbeans</databindingName>
                        <wsdlFile>${basedir}/wsdl/service.wsdl</wsdlFile>
                        <outputDirectory>${basedir}/testdirectory</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

理论上,这应该在testdirectory/test/testpackage目录中生成包名为"test.testpackage"的代码.但是,它会在testdirectory.src.test.testpackage目录中创建以下包:Src.test.testpackage.它总是在包名和目录中添加"src" - 如果我将包名更改为src.test.testpackage,它将生成以下包:src.src.test.testpackage.

当然,这会导致一个巨大的问题,因为每个生成的文件都有以下错误:"声明的包"src.test.testpackage"与预期的包"src.src.test.testpackage"不匹配"

我在这里完全失败了.我根本找不到任何理由为什么它应该在任何地方添加"src".我注意到一个自动生成的build.xml文件,其中包含一个名为sourcedirectory = x/src(或类似的东西)的值,但我无法做任何事情来影响这个值(尝试更改它然后保存文件没有区别很明显,因为它是在我下次运行maven时再次生成的.

哦,我通常使用命令"mvn clean install"和WSDL2Code的1.4.1版本,因此它不是旧的wsdl2code:wsdl2code错误之一.

如果有人知道这里究竟出了什么问题,我会非常感激.

提前致谢.

axis2 maven-2 wsdl2code

5
推荐指数
2
解决办法
5715
查看次数

如何使用axis2-wsdl2code-maven-plugin设置-Euwc param?

我们正在使用axis2来生成Web服务客户端(我现在后悔!).使用axis2命令行工具,您可以将switch -Euwc传递给Integer,将boolean传递给Boolean,以及生成的soruces等等.这是告诉axis2 可以使某些int或boolean值在模式中可以为空的一种方法.

我的问题是如何通过POM或Maven的其他方式设置此参数以实现与生成源相同的行为?我的stackoverflow和谷歌搜索没有太多揭示.有一个Jira问题,似乎被开发人员关闭而没有指向正确的方向.

<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.futile.bizzareservice</groupId>
<artifactId>BizzareService</artifactId>
<version>2.0</version>
<name>BizzareService</name>
<properties>
    <wsdl.location>unfortunate-wsdls</wsdl.location>
    <axis2.version>1.5.4</axis2.version>
</properties>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>${axis2.version}</version>
            <configuration>                 
                <packageName>com.futile.bizzareservice.client</packageName>
                <wsdlFile>${wsdl.location}/bizzareservice.wsdl</wsdlFile>
                <language>java</language>
                <databindingName>adb</databindingName>
                <unpackClasses>true</unpackClasses>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2</artifactId>
        <version>${axis2.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb</artifactId>
        <version>${axis2.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb-codegen</artifactId>
        <version>${axis2.version}</version>
    </dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)

在配置中将unwrap设置为true无济于事,因为它们是一个不同的选项.我将来会避免使用axis2,但暂时我们会坚持使用它.

autoboxing axis2 wsdl2code maven

5
推荐指数
1
解决办法
1802
查看次数