如何在 jboss 上以编程方式设置 jax-ws 客户端请求超时? [英] How do I set the jax-ws client request timeout programatically on jboss?

查看:25
本文介绍了如何在 jboss 上以编程方式设置 jax-ws 客户端请求超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为使用 jaxws-maven-plugin 生成的 jax-ws-webservice-client 设置请求(和连接)超时.在 tomcat 或 jetty 下运行我的应用程序时,超时有效,但在 jboss 下部署时,它不会占用".

I am trying to set the request (and connection) timeout for a jax-ws-webservice-client generated with the jaxws-maven-plugin. When running my app under tomcat or jetty the timeout works, but when deployed under jboss it doesn't "take".

private void setRequestAndConnectionTimeout(Object wsPort) {
  String REQUEST_TIMEOUT = BindingProviderProperties.REQUEST_TIMEOUT; // "com.sun.xml.ws.request.timeout";
  ((BindingProvider) wsPort).getRequestContext().put(REQUEST_TIMEOUT, timeoutInMillisecs);
  ((BindingProvider) wsPort).getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT, timeoutInMillisecs);
}

对 JBoss 执行此操作的正确方法是什么?

What is the correct way to do this for JBoss?

推荐答案

在 Jboss 中试试这个代码:

Try with this code in Jboss:

(BindingProvider)wsPort).getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, yourTimeoutInMillisec);

看看这个线程.

这篇关于如何在 jboss 上以编程方式设置 jax-ws 客户端请求超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆