Just figured out how to call my slim web service via XML-RPC using Ruby. It's as easy as in Python.

Here's the code:


require "xmlrpc/client"
# Make an object to represent the XML-RPC server.
server = XMLRPC::Client.new( "www.peterbe.com", "/")
# Call the remote server and get our result
result = server.call("slim", "h1 { font-family: Arial;}","css")
puts result
result = server.call("slim", 
  "function add(var1, var2) { return var1 + var2; }","js")
puts result

And when you run this on the command line this is what you get:


$ ruby dummy.rb
h1{font-family:Arial}
function add(_0,_1){return _0 + _1;}

Comments

Your email will never ever be published.

Previous:
slim, a new free web service for white space optimisation July 25, 2006 Python
Next:
Exploding Dell laptops July 31, 2006 Misc. links
Related by category:
How to find which git SHA it was when you merged in the default branch February 26, 2026 Linux
hylite as an executable October 15, 2025 Linux
Elasticsearch memory usage December 11, 2025 Linux
How to count the number of non-blank lines with Bash September 3, 2025 Linux
Related by keyword:
Leibniz formula for π in Python, JavaScript, and Ruby March 14, 2024 Python, JavaScript
Converting Celsius to Fahrenheit round-up July 22, 2024 Python, Go, Node, JavaScript, Bun, Ruby, Rust
Ruby and Python benchmarked September 25, 2005 Python