java 在 Axis2 wsdl2code Maven 插件中使用多个 WSDL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6770757/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 17:11:54  来源:igfitidea点击:

Using multiple WSDLs with Axis2 wsdl2code Maven plugin

javamavencode-generationaxis2wsdl2code

提问by David J. Liszewski

I'm creating a client with Maven2 that uses several web services. I'm restricted to using Axis2or other framework supporting Apache HttpClientas an HTTP conduit because these services require integration with a managed certificate solution based on HttpClient.

我正在使用 Maven2 创建一个使用多个 Web 服务的客户端。我只能使用Axis2Apache 或其他支持 ApacheHttpClient作为 HTTP 管道的框架,因为这些服务需要与基于HttpClient.

I'm familiar with CXF's code-gen Maven plugin which allows multiple WSDLs to be input during code generation. However, the Axis2 code-gen plugin can process only one WSDL at a time.

我熟悉 CXF 的代码生成 Maven 插件,它允许在代码生成过程中输入多个 WSDL。但是,Axis2 代码生成插件一次只能处理一个 WSDL。

How can I make Maven run wsdl2codefor each WSDL during code-gen phase? Do I need multiple profiles for this?

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

The build section of POM looks like this:

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>

References

参考

回答by guido

You can try with this, i could not test it right now but i think should work

你可以试试这个,我现在无法测试,但我认为应该可以

   <plugin>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
            <execution>
                <id>ws1</id>
                <goals>
                    <goal>wsdl2code</goal>
                </goals>
                <configuration>
                   <unpackClasses>true</unpackClasses>
                   <databindingName>adb</databindingName>
                   <packageName>org.example.stackoverflow.axis2-maven</packageName>
                   <wsdlFile>src/main/resources/service1.wsdl</wsdlFile>
                   <outputDirectory>target/generated-sources</outputDirectory>
                   <syncMode>sync</syncMode>
                </configuration>
            </execution>
            <execution>
                <id>ws2</id>
                <goals>
                    <goal>wsdl2code</goal>
                </goals>
                <configuration>
                   <unpackClasses>true</unpackClasses>
                   <databindingName>adb</databindingName>
                   <packageName>org.example.stackoverflow.axis2-maven</packageName>
                   <wsdlFile>src/main/resources/service2.wsdl</wsdlFile>
                   <outputDirectory>target/generated-sources</outputDirectory>
                   <syncMode>sync</syncMode>
                </configuration>
            </execution>
        </executions>
    </plugin>