Kung Fu Kung Fu

Fujian White Crane Kung Fu

Zope Zope

What I have and am doing with Zope

Photos Photos

Photoalbum, both old and new.

Receptsamlingen Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me Contact me

My contact details and how to contact me.

  Mobile version of this page Mobile version of this page


 

slim in ruby

xml rpc, ruby, slim, xml-rpc

26th of July 2006

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;}


Comment

 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.