将多个 WSDL 与 Axis2 wsdl2code Maven 插件结合使用
我正在使用 Maven2 创建一个使用多个 Web 服务的客户端。我只能使用 Axis2 或其他支持 Apache HttpClient 的框架作为 HTTP 管道,因为这些服务需要与基于 HttpClient 的托管证书解决方案集成>。
我熟悉 CXF 的代码生成 Maven 插件,它允许在代码生成期间输入多个 WSDL。然而,Axis2 code-gen 插件一次只能处理一个 WSDL。
如何让 Maven 在代码生成阶段为每个 WSDL 运行 wsdl2code
?为此我需要多个配置文件吗?
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>
参考文献
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 process 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以尝试一下,我现在无法测试它,但我认为应该可以
You can try with this, i could not test it right now but i think should work
我知道这是一个老问题,但还有另一种方法可以解决这个问题:
通过这种方式,您可以为所有 wsdl 提供唯一的配置
i know that is a old question but there is another way to risolve this:
with that way you have a unique configuration for all wsdl