【问题标题】:Generate *PortProxy.java with wsimport使用 wsimport 生成 *PortProxy.java
【发布时间】:2014-12-15 10:21:06
【问题描述】:
我正在尝试使用 Maven 生成 JAXWS 客户端。为此,我使用“org.jvnet.jax-ws-commons:jaxws-maven-plugin”。该插件会生成所有必需的文件,但不会生成 *PortProxy.java。
我尝试使用 wsimport 的命令行版本生成客户端。我使用了来自 JDK1.7.0_55 (x64)、JDK1.7.0_65 (x86) 和 IBM WebSphere Application Server Version 8 的不同版本的 wsimport。
生成 *PortProxy.java 文件的唯一可行方法是使用 Eclipse 向导。 (右键单击 WSDL --> Generate --> Client --> Set the client project --> Finish。)。向导和 CLI 之间有什么区别?
感谢您的帮助。
【问题讨论】:
标签:
maven
jax-ws
wsimport
jaxws-maven-plugin
【解决方案1】:
我认为您正在寻找错误生成的客户端类。
它应该类似于 *Service.java 。
如果找不到这样的类,请在以下位置寻找具有类似内容的类:
static {
URL url = null;
WebServiceException e = null;
try {
url = new URL("http://localhost:8080/ws/countries.wsdl");
} catch (MalformedURLException ex) {
e = new WebServiceException(ex);
}
WORKFLOWAPIPORTSERVICE_WSDL_LOCATION = url;
WORKFLOWAPIPORTSERVICE_EXCEPTION = e;
}
插件:
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>localhost_8080/ws/countries.wsdl</wsdlFile>
</wsdlFiles>
<packageName>xxx</packageName>
<wsdlLocation>http://localhost:8080/ws/countries.wsdl</wsdlLocation>
<staleFile>${project.build.directory}/jaxws/stale/countries.stale</staleFile>
</configuration>
<id>wsimport-generate-countries</id>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
<extension>true</extension>
<catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
</configuration>
</plugin>