指定使用 JAX-WS 进行初始 WSDL 检索的超时?

发布于 2024-12-13 01:52:24 字数 536 浏览 2 评论 0原文

使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不必你懂 2024-12-20 01:52:24

假设非托管客户端:

如果您使用生成的绑定,则应该有一个采用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文