Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use Ruby's XMLRPC::Client::new3
    text
    copied!<p>I'm trying to sort out how to use the new3 method of the XMLRPC::Client class. This is what I have:</p> <pre><code>#!/usr/bin/ruby require "xmlrpc/client" params = { host: "https://192.168.1.2", path: "rpc/api", port: "443", proxy_host: "", proxy_port: "", user: "username", password: "password", use_ssl: "true", timeout: 300, } session = XMLRPC::Client.new3(params) session.instance_variable_get(:@http).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE) sys_ver = session.call('api.systemVersion') users = session.call("user.listUsers", session) </code></pre> <p>If I use the new2 method the script will connect and return a 404 error. However, if I use the new3 it returns</p> <pre><code>/usr/lib/ruby/1.9.1/net/http.rb:762:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED) from /usr/lib/ruby/1.9.1/net/http.rb:762:in `open' from /usr/lib/ruby/1.9.1/net/http.rb:762:in `block in connect' from /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout' from /usr/lib/ruby/1.9.1/timeout.rb:99:in `timeout' from /usr/lib/ruby/1.9.1/net/http.rb:762:in `connect' from /usr/lib/ruby/1.9.1/net/http.rb:755:in `do_start' from /usr/lib/ruby/1.9.1/net/http.rb:750:in `start' from /usr/lib/ruby/1.9.1/xmlrpc/client.rb:535:in `do_rpc' from /usr/lib/ruby/1.9.1/xmlrpc/client.rb:420:in `call2' from /usr/lib/ruby/1.9.1/xmlrpc/client.rb:410:in `call' from sat_test.rb:24:in `&lt;main&gt;' </code></pre> <p>Am I using the new3 method properly?</p> <p>Also, if I use the new method instead, do I need to set parameter=value for each parameter (proxy_host=, proxy_port=, etc)?</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