5

我使用生成 Web 服务客户端

<plugin> 
 <groupId>org.jvnet.jax-ws-commons</groupId> 
 <artifactId>jaxws-maven-plugin</artifactId> 
 <version>2.3</version> 
 <configuration>
  <target>2.1</target> 
  <xnocompile>false</xnocompile> 
 </configuration>
 <executions>
  <execution> 
   <goals> 
    <goal>wsimport</goal> 
   </goals>
  </execution> 
 </executions>
</plugin>

我的 EndpointService.wsdl 在 src/main/wsdl 中。插件生成带有注解的 EndpointServiceService.java

@WebServiceClient(name = "EndpointServiceService", targetNamespace = "http://soap.endpoint.fsg.ftc/", wsdlLocation = "file:/D:/Source/java/branches/9.3.0/camel-smev/wscapi/src/wsdl/EndpointService.wsdl")

所以如果wsdl

D:/Source/java/branches/9.3.0/camel-smev/wscapi/src/wsdl/EndpointService.wsdl 

不存在(在另一台机器上),它在运行时抛出异常。如果我将 wsdl 复制到此目录,它将成功运行。如何将 wsdl 包含到我的目标 jar 中并让客户使用它?或者如何在运行时完全排除 wsdl 依赖?也许尝试旧版本或其他插件?

4

1 回答 1

4

将插件配置中的 < wsdllocation > 标记添加到 wsdl 的相对路径。你可以在这里找到一个例子

于 2017-01-27T05:06:48.627 回答