Ruby has standard class for XML-RPC called XMLRPC::Client – you can find the documentation at

  1. Load class XMLRPC::Client.
require "xmlrpc/client"
  1. Define structs AuthInfo, ServerAddress and CreationParameters.
AuthInfo = "AuthInfo", :login, :password )
ServerAddress = "ServerAddress", :ips, :macs )
CreationParameters = "CreationParameters", :hwid )
  1. Define server connection.
server = XMLRPC::Client.new2( '', nil, 900 )

4. Perform call to server and store response in result variable. Start with a begin. The code starting from here should be put into an begin/end block to catch possible exceptions. The method requires the following parameters:

  • String: method name
  • Struct: authInfo
  • String: kaclient
  • String: keytype
  • Array: features (pay attention that even if you only have a single feature or even none, you need to send an array)
  • Struct: CreationParameters for main Key
  • Array: additional Keys
  • Struct: CreationParameters for additional Keys
puts 'Performing Call'
result = "partner10.createKey", "API_USER", "API_PASSWORD" ), [ "" ], [] ),
['2CPU_40VPS'],'2111.4355.5697.53D9.C5B3.766A.843A.1984' ),
[ 'VIRTUOZZO_TOOLS' ], '2111.4355.5697.53D9.C5B3.766A.843A.1984' ))
  1. Print out result from response.
puts "Contents:"
result.each { | key, value | puts "#{key}: #{value}" }
  1. Catch exceptions and finish begin/end block with end.
rescue XMLRPC::FaultException => e
puts "Error:"
puts e.faultCode
puts e.faultString