Note that there are some explanatory texts on larger screens.

plurals
  1. POsetting response timeout in ruby XMLRPC not working
    text
    copied!<p>I am trying to programmatically upload a large-sized (10+ MB) file to a server that supports XMLRPC. </p> <p>For those interested, the background is:</p> <ul> <li>The server is Confluence. </li> <li>I am trying to upload a file as attachment to a Confluence page.</li> <li>I am using <a href="https://developer.atlassian.com/display/CONFDEV/Confluence+XML-RPC+and+SOAP+APIs" rel="nofollow">the Confluence XMLRPC API</a>. The API call is <a href="https://developer.atlassian.com/display/CONFDEV/Remote+Confluence+Methods" rel="nofollow">addAttachment</a>.</li> </ul> <p>The code looks something like this</p> <pre><code>require 'xmlrpc/client' server = XMLRPC::Client.new2(server_url,"",600) # one attempt to set timeout server.instance_variable_get(:@http).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE) server.timeout=6000 # another attempt to set timeout @conf = server.proxy("confluence2") </code></pre> <p>I know that the XMLRPC client will wait for <code>TIMEOUT</code> seconds before it aborts. So its natural that I got the following response when trying to upload the large file (smaller files don't throw this error).</p> <pre><code>C:/Ruby193/lib/ruby/1.9.1/openssl/buffering.rb:318:in `syswrite': An established connection was aborted by the software in your host machine. (Errno::ECONNABORTED) from C:/Ruby193/lib/ruby/1.9.1/openssl/buffering.rb:318:in `do_write' from C:/Ruby193/lib/ruby/1.9.1/openssl/buffering.rb:336:in `write' from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:199:in `write0' from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:173:in `block in write' from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:190:in `writing' from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:172:in `write' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1938:in `send_request_with_body' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1920:in `exec' </code></pre> <p>However, I am unable to properly set the response timeout. I have tried</p> <ul> <li><a href="http://www.ruby-doc.org/stdlib-2.0.0/libdoc/xmlrpc/rdoc/XMLRPC/Client.html#method-i-timeout-3D" rel="nofollow">server.timeout</a></li> <li><a href="http://www.ruby-doc.org/stdlib-2.0.0/libdoc/xmlrpc/rdoc/XMLRPC/Client.html#method-i-new2" rel="nofollow">the timeout parameter in the new2 call</a></li> </ul> <p>Neither of which work. I have verified that the client still waits the default 30 seconds for the response, and then throws the error. So, what am I doing wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload