在不下载WSDL的情况下实例化JAX-WS服务? [英] Instantiate JAX-WS service without downloading WSDL?
本文介绍了在不下载WSDL的情况下实例化JAX-WS服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Web服务,我有JAX-WS生成的客户端绑定如下:
I have a web service that I have JAX-WS generated client bindings as below:
// web service client generated by JAX-WS
@WebServiceClient( ... )
public class WebService_Service extends Service {
public WebService_Service(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
WebService getWebServiceSOAP() {
// ...
}
}
我希望能够创建一个指向远程服务的实例,如:
I want to be able to create an instance of this that points to a remote service like:
WebService_Service svc = new WebService_Service(
new URL("http://www.example.com/ws?wsdl"),
new QName("http://www.example.com/ws", "WebService"));
但是从 http://www.example.com下载WSDL / ws?wsdl
我不想这样做。
有没有办法停止下载该WSDL,但仍然指向到同一个端点?
Is there a way to stop the downloading of that WSDL, but still point to that same endpoint?
推荐答案
我通过在客户端为WSDL URL指定null来解决这个问题,并指定了端点显式地址:
I resolved this by specifying null for the WSDL URL in the client, as well as specifying the endpoint address explicitly:
WebService_Service svc = new WebService_Service(
null,
new QName("http://www.example.com/ws", "WebService"));
WebService port = svc.getPort(WebService.class);
BindingProvider bindingProvider = (BindingProvider) port;
bindingProvider.getRequestContext()
.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
"http://www.example.com/real_endpoint_url_goes_here");
这篇关于在不下载WSDL的情况下实例化JAX-WS服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文