使用 axis1.4 时未考虑超时
我在初始化 Web 服务存根时设置超时,甚至在调用之前使用 getTimeout() 记录它以确保它已设置,但无论设置的超时值如何,调用都会完成。这有可能是一个错误还是我在这里遗漏了一些东西?
下面是我执行此操作的代码:
proxy = new DCPControllerWSPortTypeProxy();
proxy.setEndpoint(endpoint);
((Stub)proxy.getDCPControllerWSPortType()).setTimeout(120000);
I'm setting the timeout when initializing the webservice stub and I'm even logging it using getTimeout() before making the call to make sure it's set but the call completes regardless of the timeout value set. Is it possible this is a bug or am I missing something here?
Below is my code doing this:
proxy = new DCPControllerWSPortTypeProxy();
proxy.setEndpoint(endpoint);
((Stub)proxy.getDCPControllerWSPortType()).setTimeout(120000);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要解决此问题,您必须在项目中的任意位置添加以下类。当我遇到类似的问题时,我已将其声明为与我实例化存根的同一类中的私有类。 (我目前正在使用 Axis 2 )
完成此操作后,您可以在代码中添加以下行,这将设置超时。
或者您可以简单地执行以下操作,因为您实际上并不需要正在创建的对象:
这之前已被报告为错误,其中使用 HTTPS 连接时未设置连接超时和读取超时: https://bugs.java.com/bugdatabase/view_bug?bug_id=4700777
以下链接帮助我找到了此解决方法:
http://www.noizeramp.com/article.php?article=se- Networking_Specifics_under_Java_Web_Start
我希望这会对您有所帮助 =)
To fix the problem, you will have to add the following class wherever you want in your project. When I had a similar problem, I have declared it as a private class in the same class where I'm instantiating my stub. (I'm currently using Axis 2 )
After doing that, you could add the following line in your code, which will set the timeout.
Or you could simply do the following, since you don't really need the object that's being created:
This has been reported as a bug before, where connection timeouts and read timeouts are not being set when using HTTPS connections : https://bugs.java.com/bugdatabase/view_bug?bug_id=4700777
The following link helped me figure out this workaround:
http://www.noizeramp.com/article.php?article=se-networking_specifics_under_Java_Web_Start
I hope this will help you somehow =)