[Awesome Ruby Gem] Use xmlrpc gem to call remote procedure over HTTP
xmlrpc
XMLRPC is a lightweight protocol that enables remote procedure calls over HTTP. It is defined at What is XML-RPC? - http://www.xmlrpc.com.
XMLRPC allows you to create simple distributed computing solutions that span computer languages. Its distinctive feature is its simplicity compared to other approaches like SOAP and CORBA.
The Ruby standard library package xmlrpc
enables you to create a server that implements remote procedures and a client that calls them. Very little code is required to achieve either of these.
Starting in Ruby 2.4.0
, the xmlrpc
library that was before bundled with ruby has been extracted to a gem. So you must just add this to your Gemfile
file and bundle
again.
Installation
You can install it as a gem:
1 | gem install xmlrpc |
or add it into a Gemfile (Bundler):
1 | # Gemfile |
Then, run bundle install
.
1 | bundle install |
Example
Try the following code. It calls a standard demonstration remote procedure.
1 | require 'xmlrpc/client' |
References
[1] GitHub - ruby/xmlrpc: The Ruby standard library package ‘xmlrpc’ - https://github.com/ruby/xmlrpc
[2] xmlrpc | RubyGems.org | your community gem host - https://rubygems.org/gems/xmlrpc/