I generated a web-service client using JBoss utils (JAX-WS compatible) using Eclipse 'web service client from a wsdl'.

我使用来自wsdl'的Eclipse'Web服务客户端,使用JBoss utils(JAX-WS兼容)生成了一个Web服务客户端。

So, the only thing I provided was a url to a web-service WSDL.

所以,我唯一提供的是Web服务WSDL的URL。

Now, the web service provider tells me to change the "url of client endpoint application access" of the web-service.

现在,Web服务提供商告诉我更改Web服务的“客户端端点应用程序访问的URL”。

What is it and how to change it?

它是什么以及如何改变它?

3 个解决方案

#1


141

IMO, the provider is telling you to change the service endpoint (i.e. where to reach the web service), not the client endpoint (I don't understand what this could be). To change the service endpoint, you basically have two options.

IMO,提供商告诉您更改服务端点(即到达Web服务的位置),而不是客户端端点(我不明白这可能是什么)。要更改服务端点,您基本上有两个选项。

Use the Binding Provider to set the endpoint URL

The first option is to change the BindingProvider.ENDPOINT_ADDRESS_PROPERTY property value of the BindingProvider (every proxy implements javax.xml.ws.BindingProvider interface):

第一个选项是更改BindingProvider的BindingProvider.ENDPOINT_ADDRESS_PROPERTY属性值(每个代理实现javax.xml.ws.BindingProvider接口):

...
EchoService service = new EchoService();
Echo port = service.getEchoPort();

/* Set NEW Endpoint Location */
String endpointURL = "http://NEW_ENDPOINT_URL";
BindingProvider bp = (BindingProvider)port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);

System.out.println("Server said: " + echo.echo(args[0]));
...

The drawback is that this only works when the original WSDL is still accessible. Not recommended.

缺点是这只有在原始WSDL仍可访问时才有效。不建议。

Use the WSDL to get the endpoint URL

The second option is to get the endpoint URL from the WSDL.

第二个选项是从WSDL获取端点URL。

...
URL newEndpoint = new URL("NEW_ENDPOINT_URL");
QName qname = new QName("http://ws.mycompany.tld","EchoService"); 

EchoService service = new EchoService(newEndpoint, qname);
Echo port = service.getEchoPort();

System.out.println("Server said: " + echo.echo(args[0]));
...

更多相关文章

  1. java客户端调用 https 的webservice
  2. javascript获得客户端IP的又一方法
  3. JavaWeb-1-IOS或Android客户端上传图片到Java服务端存到数据库,再
  4. Netty学习心得 netty服务端和客户端的连接
  5. socket实现客户端与服务端通信(一)服务端
  6. 如果服务器位于不同的位置,如何保存客户端机器时间
  7. java远程类加载与轻客户端

随机推荐

  1. golang与java语法上的区别
  2. golang-cache是全局吗
  3. golang中使用rand产生随机不重复数字
  4. golang中fscanf读取文件时把回车替换成0
  5. golang 包怎么调用
  6. golang 1.9什么时候发布
  7. golang中的print与fmt的区别
  8. golang中的错误处理方法
  9. golang中的int占几个字节
  10. golang中的bee是指什么