Thanks. After testing your one-liner and finding it working (to a degree, more on that in a minute) I moved the hash key/values into the new3 call directly instead of passing "params" as the argument.
As for working to a degree. I'm now getting 404 Not Found. I got the same result with the example Perl script. If I navigate to https://host.example.com/rpc/api in a browser I get the same thing. It seems I'm missing something on my server. Have you ever seen that? -Mathew "When you do things right, people won't be sure you've done anything at all." - God; Futurama "We'll get along much better once you accept that you're wrong and neither am I." - Me On Mon, Apr 22, 2013 at 7:11 PM, Jan Pazdziora <[email protected]>wrote: > On Mon, Apr 22, 2013 at 06:15:51PM +0100, Mathew Snyder wrote: > > I'm trying to connect to the API for our Satellite server. According to > > everything I've read it should be at > https://satellite.example.com/rpc/api. > > I've tried this using both Ruby and Perl and have received one of two > > errors repeatedly. The first is 404 Not Found and the other is Connection > > refused. > > > > I'm not entirely sure how I'm supposed to connect with the xmlrpc/client > > gem in Ruby. This is my code: > > > > #!/usr/bin/ruby > > > > require "xmlrpc/client" > > > > host = "https://10.153.156.10" > > hostpath = "https://10.153.156.10/rpc/api" > > path = "rpc/api" > > username = "ecapsupport" > > pass = "r310ADed" > > > > params = { > > "host" => "https://REDACTED", > > "path" => "rpc/api", > > "port" => "443", > > "proxy_host" => "", > > "proxy_port" => "", > > "user" => "REDACTED", > > "password" => "REDACTED", > > "use_ssl" => "true", > > "timeout" => "300", > > } > > > > client = XMLRPC::Client.new3(params) > > client.instance_variable_get(:@http).instance_variable_set(:@verify_mode, > > OpenSSL::SSL::VERIFY_NONE) > > > > session = client.call('auth.login', username, pass) > > Reading > > > http://www.ruby-doc.org/stdlib-2.0/libdoc/xmlrpc/rdoc/XMLRPC/Client.html#method-c-new3 > > makes me believe that the host is the FQDN of the host, not the > "protocol://FQDN". Thus, > > ruby -e 'require "xmlrpc/client"; client = XMLRPC::Client.new3({ > "host" => "machine.example.com", "path" => "/rpc/api" }); sys_ver = > client.call("api.systemVersion"); puts sys_ver;' > 5.5.0 > > works just fine for me. Reading the same page reveals that > > XMLRPC::Client.new_from_uri("http://machine.example.com/rpc/api"); > > works as well, should you prefer to work with URIs. And with the > VERIFY_NONE mode, it even works with https. > > -- > Jan Pazdziora > Principal Software Engineer, Satellite Engineering, Red Hat > > _______________________________________________ > Spacewalk-list mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/spacewalk-list >
_______________________________________________ Spacewalk-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/spacewalk-list
