Coldfusion 消费 Web 服务 -> java.net.SocketTimeoutException:连接超时
我正在使用 Coldfusion 9 上的 Web 服务来获取属性数据并将结果保存到本地数据库。该脚本每天通过调度程序执行一次。问题是有时它会抛出错误(见下文)。
基本上,我获取了一个 ID 列表(获取此列表的一个请求),并对每个 ID 发出一个 Web 服务请求(约 150 个请求)来循环结果。
遗憾的是,我无法在一次请求中获取所有属性的详细数据。
我已经尝试在 JVM 参数中设置 -Dsun.net.client.defaultConnectTimeout=10000
- 结果相同......
"Error","jrpp-7225","10/22/11","03:00:32",,"Cannot perform web service invocation properties.
The fault returned when invoking the web service operation is:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/} Server.userException
faultSubcode:
faultString: java.net.SocketTimeoutException: connect timed out
faultActor:
faultNode:
faultDetail: {http://xml.apache.org/axis/}stackTrace:java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:15...
对此有什么想法吗?是什么导致超时:远程服务器速度慢?我们的服务器无法为新连接打开更多套接字?
I'm consuming a webservice over Coldfusion 9 for getting property data and saving the result to our local database. The script gets executed via scheduler once a day. The problem is that sometimes it throws an error (see below).
Basically I'm getting a list of IDs (one request to get this list) and loop over the result with one webservice request for every ID (~150 requests).
Sadly I can't get the detailed data for all properties in one request.
I tried already setting -Dsun.net.client.defaultConnectTimeout=10000
in the JVM Arguments - same result ...
"Error","jrpp-7225","10/22/11","03:00:32",,"Cannot perform web service invocation properties.
The fault returned when invoking the web service operation is:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/} Server.userException
faultSubcode:
faultString: java.net.SocketTimeoutException: connect timed out
faultActor:
faultNode:
faultDetail: {http://xml.apache.org/axis/}stackTrace:java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:15...
Any ideas on this one? What is causing the timeout: a slow remote server? our server which cannot open more sockets for new connections?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能必须以较小的批量执行 Web 服务请求。使用数据库或其他持久变量来存储 150 个 id 的初始列表,然后在单独的 cfschedule 调用中执行 1-50、51-100 等。您可以在代码中更新计划作业的属性,以将处理批次时的间隔设置为 61 秒,然后在所有批次完成后将其重置为原始值。
You might have to do the webservice requests in smaller batches. Use a DB or some other persisted variable to store the initial list of 150 ids, and then do 1-50, 51-100, etc in separate
cfschedule
calls. You can update the properties of the scheduled job in code to set the interval to 61 seconds while processing the batch, and then reset it to the original values once all batches are complete.