I have a datanoise action-webservice implemented SOAP rails webservice which interacts with another SOAP webservice by posting XML SOAP requests to the third-party URL:
open("http://localhost:8080/generateResponse?xmlRequest="+CGI.escape(soapRQ.result(binding).gsub("\n","")))
Periodically this results in an exception (stacktrace below). I just cant understand what triggers this 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'
The server side is on RHEL5 host. Rails 2.3.5 and Ruby 1.8.7. Thirdpart post is a simple java war deployed into JBOSS 4.3
I found the problem was because of the size of the URL being generated from the ERB binding result for the xmlRequest parameter – it was obviously too long for a URL using open. I switched to a POST and it works fine.