xmlrpc-endpoint

Rails has native support for xmlrpc. Most people are familiar with the ‘xmlrpc/client’ library. The ‘xmlrpc/server’ library examples mostly make an assumption that you will run a standalone server.

xmlrpc-endpoint allows you to expose normal Rails controller methods via XMLRPC, tied to a single xmlrpc endpoint route in your normal app.

Setup your environment

  • gem install xmlrpc-endpoint

  • include ActionController::Acts::XmlrpcEndpoint somewhere in your environment

  • set up a route to the action “index” in your controller (this action will be created for you by the xmlrpc-endpoint)

Add this code to your controller:

class MyApiController < ApplicationController
  exposes_xmlrpc_methods
end

Then, pointing an XMLRPC client at the defined route, your normal controller actions will handle the requests.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 Will Koffel, released under the MIT license.