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:
set -ex - The most useful bash trick of the year August 31, 2014 Linux
brotli_static in Nginx November 8, 2024 Linux
Be very careful with your add_header in Nginx! You might make your site insecure February 11, 2018 Linux
Linux tip: du --max-depth=1 September 27, 2007 Linux
Related by keyword:
Converting Celsius to Fahrenheit round-up July 22, 2024 Python, Go, Node, JavaScript, Bun, Ruby, Rust
Leibniz formula for π in Python, JavaScript, and Ruby March 14, 2024 Python, JavaScript
Ruby and Python benchmarked September 25, 2005 Python