1

我有一个 datanoise action-webservice 实现的 SOAP rails webservice,它通过将 XML SOAP 请求发布到第三方 URL 来与另一个 SOAP webservice 交互:

open("http://localhost:8080/generateResponse?xmlRequest="+CGI.escape(soapRQ.result(binding).gsub("\n","")))

这会定期导致异常(下面的堆栈跟踪)。我只是不明白是什么触发了这个 ECONNRESET:

Errno::ECONNRESET (Connection reset by peer):
  /usr/local/lib/ruby/1.8/net/protocol.rb:135:in `sysread'
  /usr/local/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
  /usr/local/lib/ruby/1.8/timeout.rb:67:in `timeout'
  /usr/local/lib/ruby/1.8/timeout.rb:101:in `timeout'
  /usr/local/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
  /usr/local/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
  /usr/local/lib/ruby/1.8/net/protocol.rb:126:in `readline'
  /usr/local/lib/ruby/1.8/net/http.rb:2028:in `read_status_line'
  /usr/local/lib/ruby/1.8/net/http.rb:2017:in `read_new'
  /usr/local/lib/ruby/1.8/net/http.rb:1051:in `request'
  /usr/local/lib/ruby/1.8/open-uri.rb:248:in `open_http'
  /usr/local/lib/ruby/1.8/net/http.rb:543:in `start'
  /usr/local/lib/ruby/1.8/open-uri.rb:242:in `open_http'
  /usr/local/lib/ruby/1.8/open-uri.rb:616:in `buffer_open'
  /usr/local/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
  /usr/local/lib/ruby/1.8/open-uri.rb:162:in `catch'
  /usr/local/lib/ruby/1.8/open-uri.rb:162:in `open_loop'
  /usr/local/lib/ruby/1.8/open-uri.rb:132:in `open_uri'
  /usr/local/lib/ruby/1.8/open-uri.rb:518:in `open'
  /usr/local/lib/ruby/1.8/open-uri.rb:30:in `open'
  app/controllers/my_websvc_controller.rb:2354:in `postRequest'
 /usr/local/lib/ruby/gems/1.8/gems/datanoise-actionwebservice-2.3.2/lib/action_web_service/invocation.rb:141:in `send'
 /usr/local/lib/ruby/gems/1.8/gems/datanoise-actionwebservice-2.3.2/lib/action_web_service/invocation.rb:141:in `perform_invocation_without_interception'
 /usr/local/lib/ruby/gems/1.8/gems/datanoise-actionwebservice-2.3.2/lib/action_web_service/invocation.rb:135:in `perform_invocation'
 /usr/local/lib/ruby/gems/1.8/gems/datanoise-actionwebservice-2.3.2/lib/action_web_service/dispatcher/abstract.rb:46:in `web_service_filtered_invoke'
 /usr/local/lib/ruby/gems/1.8/gems/datanoise-actionwebservice-2.3.2/lib/action_web_service/dispatcher/abstract.rb:37:in `web_service_direct_invoke_without_controller'
 /usr/local/lib/ruby/gems/1.8/gems/datanoise-actionwebservice-2.3.2/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:112:in `web_service_direct_invoke'
 /usr/local/lib/ruby/gems/1.8/gems/datanoise-actionwebservice-2.3.2/lib/action_web_service/dispatcher/abstract.rb:58:in `web_service_invoke'
 /usr/local/lib/ruby/gems/1.8/gems/datanoise-actionwebservice-2.3.2/lib/action_web_service/dispatcher/abstract.rb:25:in `invoke_web_service_request'
 /usr/local/lib/ruby/gems/1.8/gems/datanoise-actionwebservice-2.3.2/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:58:in `dispatch_web_service_request'
 /usr/local/lib/ruby/gems/1.8/gems/datanoise-actionwebservice-2.3.2/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:56:in `dispatch_web_service_request'
(eval):1:in `api'

服务器端位于 RHEL5 主机上。Rails 2.3.5 和 Ruby 1.8.7。第三部分是部署到 JBOSS 4.3 中的简单 java 战争

4

1 回答 1

1

我发现问题是因为从 xmlRequest 参数的 ERB 绑定结果生成的 URL 的大小 - 对于使用 open 的 URL 来说显然太长了。我切换到 POST 并且工作正常。

于 2012-08-08T19:16:34.137 回答