简体   繁体   English

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

[英]Using multiple WSDLs with Axis2 wsdl2code Maven plugin

I'm creating a client with Maven2 that uses several web services. 我正在使用Maven2创建一个使用多个Web服务的客户端。 I'm restricted to using Axis2 or other framework supporting Apache HttpClient as an HTTP conduit because these services require integration with a managed certificate solution based on HttpClient . 我仅限于使用Axis2或支持Apache HttpClient其他框架作为HTTP管道,因为这些服务需要与基于HttpClient的托管证书解决方案集成。

I'm familiar with CXF's code-gen Maven plugin which allows multiple WSDLs to be input during code generation. 我熟悉CXF的代码生成Maven插件,允许在代码生成期间输入多个WSDL。 However, the Axis2 code-gen plugin can process only one WSDL at a time. 但是,Axis2代码生成插件一次只能处理一个WSDL。

How can I make Maven run wsdl2code for each WSDL during code-gen phase? 如何在代码生成阶段让Maven为每个WSDL运行wsdl2code Do I need multiple profiles for this? 我需要多个配置文件吗?

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 参考

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM