开发者

Using multiple WSDLs with Axis2 wsdl2code Maven plugin

开发者 https://www.devze.com 2023-03-22 07:30 出处:网络
I\'m creating a client with Maven2 that uses several web services.I\'m restricted to using Axis2 or other framework supporting Apache HttpClient as an HTTP conduit because these services require integ

I'm creating a client with Maven2 that uses several web services. 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.

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 pro开发者_运维技巧cess only one WSDL at a time.

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

The build section of POM looks like this:

<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

  • Maven2 WSDL2Code Plug-in Guide
  • wsdl2code command line tool


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号