From: Michael Neumann Date: 2001-02-25T04:47:20+09:00 Subject: [ruby-talk:11477] Re: XML-RPC and KDE Michael Schuerig wrote: > > Ruby has an XML-RPC package and KDE has the XmlRpc Daemon. See > > and . > > Unfortunately, I don't seem to get them to work together. The Ruby > xml-rpc sample does work on my machine, but I'd like to get to work a > moral equivalent of the following Python code > > > #!/usr/bin/python > from xmlrpclib import * > import os > > rc = open(os.environ['HOME'] + '/.kxmlrpcd', 'r') > config = string.split(rc.read(), ',') > port = config[0] > auth = config[1] > > server = Server("http://localhost:" + port +"/kdesktop") > server.KDesktopIface.popupExecuteCommand(auth); Try following piece of code: require "xmlrpc/client" port, auth = File.readlines(ENV['HOME'] + '/.kxmlrpcd').to_s.split(',') server = XMLRPC::Client.new("localhost", "/kdesktop", port) begin server.call("KDesktopIface.popupExecuteCommand", auth) rescue XMLRPC::FaultException => e p "Error: ", e.faultCode, e.faultString end I have not tested it, but it should work. -- Michael Neumann