问题描述
我正在尝试直接从@Webservice类生成WS客户端jar.
I am trying to generate the WS client jar directly from the @Webservice class(es).
让我们举个例子:
package com.example.maven.jaxws.helloservice;
import javax.jws.WebService;
@WebService
public class Hello {
public String sayHello(String param) {
; return "Hello " + param;
}
}
我可以生成一个战争文件并使用glassfish来提供此Web服务,然后从那里我可以使用glassfish WSDL URL来生成客户端源.
I can generate a war file and use glassfish to serve this webservice, and from there I can use the glassfish WSDL URL to generate the client sources.
我想做的是跳过玻璃鱼部分.从我定义Web服务的Maven项目中,我想使用jaxws-maven-plugin创建客户端类,但是找不到任何方法来指定Web服务的实际URL.
What I am trying to do is to skip the glassfish part.From my maven project defining the webservice, I would like to use the jaxws-maven-plugin to create the client classes but I cannot find any way to specify the actual URL of the webservice.
应该可以吧?
推荐答案
您应使用<wsdlLocation>
选项提供在部署后WSDL文件将可用的服务的位置.
You should use <wsdlLocation>
option to give the location of the service where the WSDL file is going to be available after deployment.
还有另一种简单的方法- 只需使用-wsdlLocation运行wsimport 切换并提供WSDL位置 相对于 生成的服务类,您需要 将此WSDL文件放在此相对位置 位置.
There is another easy way to do it - just run wsimport with -wsdlLocation switch and provide the WSDL location value which is relative to the generated Service class and you need to put this WSDL file at this relative location.
这篇关于直接从源代码创建Web服务客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!