指定使用 JAX-WS 进行初始 WSDL 检索的超时?
使用 JAX-WS 指定初始 WSDL 检索超时的最佳方法是什么?
似乎可以使用以下命令指定 Web 服务调用的超时:
((BindingProvider) port).getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, 2000);
((BindingProvider) port).getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, 2000);
但它不会影响 WSDL 文件的初始检索。
似乎也可以使用此系统属性为所有 HttpUrlConnection 调用全局指定超时:
sun.net.client.defaultConnectTimeout
但它会影响所有调用,而不仅仅是此调用。
还有一种简单的方法来使用 WSDL 文件的本地副本,以便不执行 WSDL 文件的初始检索吗?
谢谢
What is the best way to specify a timeout to the initial WSDL retrieval with JAX-WS?
It seems possible to specify timeouts for the Web Services calls using:
((BindingProvider) port).getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, 2000);
((BindingProvider) port).getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, 2000);
but it doesn't affect the initial retrieval of the WSDL file.
It also seems possible to specify globally a timeout for all HttpUrlConnection calls using this system property:
sun.net.client.defaultConnectTimeout
but it affects all calls not just this one.
Also is there a simple way to use a local copy of the WSDL file so that this initial retrieval of the WSDL file is not performed?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设非托管客户端:
如果您使用生成的绑定,则应该有一个采用 URL 的构造函数。此 URL 可以指向本地资源(例如类路径)。如果您使用动态客户端,请使用
Service.create(URL, QName)
方法做同样的事情。有关示例,请参阅此处。在托管客户端容器中,可以使用 JSR 109 中指定的捆绑 WSDL 来加载服务。
Assuming unmanaged clients:
If you're using generated bindings, there should be a constructor that takes a URL. This URL can point to a local resource (e.g. the classpath.) If you're using a dynamic client, use the
Service.create(URL, QName)
method to do the same. See here for examples.In a managed client container, the service can be loaded using a bundled WSDL as specified in JSR 109.