Action Service – Serving APIs on rails

Action Service provides a way to publish interoperable web service APIs with Rails without wasting time delving into protocol details.

Features

  • SOAP RPC protocol support

  • Dynamic WSDL generation for exported APIs

  • XML-RPC protocol support

  • Type signature hints to improve interoperability with static languages

  • Active Record model class support in signatures

Integration with Action Pack

Action Service can be integrated in two different dispatching modes, Direct and Delegated.

Direct dispatching

This is the default mode. In this mode, controller actions can be exported as API methods, and parameters for incoming method calls will be placed in @params. The return value of the action will be sent back as the return value to the caller.

Requests from callers will be sent to /controller_name/api using HTTP POST.

Direct dispatching example

class PersonApiController < ApplicationController
  def add
  end

  def remove
  end

  export :add
  export :remove
end

Delegated dispatching

This mode can be turned on by setting the service_dispatching_mode option. In this mode, a controller is a container for one or more service objects, each implementing a seperate API.

Requests from callers will be sent to /controller_name/service_name using HTTP POST.

Delegated dispatching example

class ApiController < ApplicationController
  service_dispatching_mode :delegated

  service :person, PersonApi.new
  service :customer, CustomerApi.new
end

Dependencies

Action Service requires that the Action Pack and Active Record are either available to be required immediately or are accessible as GEMs.

It also requires a version of Ruby that includes SOAP support in the standard library. At least version 1.8.2 final (2004-12-25) of Ruby is recommended, this is the version tested against.

Download

The latest Action Service version can be downloaded from rubyforge.org/projects/actionservice

Installation

You can install Action Service with the following command.

% [sudo] ruby setup.rb

License

Action Service is released under the MIT license.

Support

The Ruby on Rails mailing list

Or, to contact the author, send mail to [email protected]