Michael Schuerig wrote:
> 
> Ruby has an XML-RPC package and KDE has the XmlRpc Daemon. See
> <http://www.s-direktnet.de/homepages/neumann/xmlrpc4r/index.html>
> and <http://developer.kde.org/kde2arch/xmlrpc.html>.
> 
> 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