我该如何在jboss上以编程方式设置jax-ws客户端请求超时时间?

8

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

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中的正确做法是什么?
1个回答

9
尝试在Jboss中使用以下代码:
(BindingProvider)wsPort).getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, yourTimeoutInMillisec);

请看这个帖子:this thread。

2
解决了!StubExt在以下位置: import org.jboss.ws.core.StubExt;我不得不添加一些Maven依赖项: <dependency> <groupId>jboss-eap</groupId> <artifactId>jbossws-spi</artifactId> <version>4.3.0.GA_CP02</version> <scope>provided</scope> </dependency> jboss-eap jbossws-core 4.3.0.GA_CP02 provided 非常感谢! - Jonas Andersson

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接