我使用RAD 7.5(基于Eclipse)从Web服务WSDL生成客户端代码。实际上有2或3个需要一起生成以生成一个客户端。有没有办法自动化步骤通过Web服务客户端向导,为所有WSDL选择JAX-WS绑定文件?理想情况下,此过程还会在生成Java代码后创建Jar文件。
是否可以在RAD / Eclipse中自动执行此操作?
答案 0 :(得分:1)
您可以将Maven与Eclipse结合使用。
Maven有一个插件
http://jax-ws-commons.java.net/jaxws-maven-plugin/examples/using-wsdlLocation.html
<project>
...
<dependencies>
...
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.6</version>
</dependency>
...
</dependencies>
...
<build>
...
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<!-- Following configuration will invoke wsimport once for each wsdl. -->
<configuration>
<wsdlLocation>http://example.com/mywebservices/*</wsdlLocation>
<wsdlDirectory>src/mywsdls</wsdlDirectory>
<wsdlFiles>
<wsdlFile>a.wsdl</wsdlFile> <!-- produces wsdlLocation = http://example.com/mywebservices/a.wsdl -->
<wsdlFile>b/b.wsdl</wsdlFile> <!-- produces wsdlLocation = http://example.com/mywebservices/b/b.wsdl -->
<wsdlFile>${basedir}/src/mywsdls/c.wsdl</wsdlFile> <!-- produces wsdlLocation = /path/to/basedir/src/mywsdls/c.wsdl -->
</wsdlFiles>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
...
<build>
...
</project>