Using ActionWebService with Edge Rails/Rails 2.0


We have a Rails app running Edge Rails R8041, serving up a RESTful API
and have recently had the need arise to add a SOAP API. After a bit of
fighting with load paths setting the following in environment.rb:

config.load_paths += %W( #{RAILS_ROOT}/vendor/rails/actionwebservice/lib
config.load_paths += %W( #{RAILS_ROOT}/app/apis )

we had a quick controller running serving up a simple search facility,
located in /app/controllers/api/clients_controller.rb with the following

class Api::ClientsController < ApplicationController
session :off
web_service_dispatching_mode :delegated
web_service :clients,

There was then a corresponding API file in /app/apis/clients_service.rb

class ClientsAPI < ActionWebService::API::Base
inflect_names false
api_method :search, :expects => [{:query => :string}], :returns =>

class ClientsService < ActionWebService::Base
web_service_api ClientsAPI
def search(query)
return [] if query.blank?
return {|c| c.to_client_record(true) }

We also have a number of other services set up.

This all works as expected when running in development mode, but when
switching to production mode, or just enabling cache_classes=true in the
development environment, the services cannot be accessed, instead you
get a 404 saying no action responded to clients. The WSDL still works in
production mode.

We thought this may be an issue with having the controllers in the
nested API folder, but moving them into the root controllers folder
produced the same issue. Removing similar named unnested controllers
(i.e. /controllers/clients_controller.rb) also failed to work.

Does anyone have any insight into why these are not working, or could
share details of how they are running and configuring Rails 2 with
ActionWebService? It seems the documentation is now way out of date
since it has been removed from the core rails package, and DHH’s promise
of it just being as simple as re-including AWS doesn’t quite ring true.



I forgot to mention, switching to layered dispatching resulted in a
similar message, but saying no action responded to rpc, and switching to
direct dispatching did not work at all.

Thanks again,


Did you ever figure out what was going on with this? I seem to have
the same problem. Inside the action_controller_dispatcher.rb file the
following code doesn’t seem to be executed the first time the class

    base.add_web_service_api_callback do |klass, api|
      if klass.web_service_dispatching_mode == :direct
        klass.class_eval 'def api; dispatch_web_service_request;

base.add_web_service_definition_callback do |klass, name,
if klass.web_service_dispatching_mode == :delegated
klass.class_eval “def #{name};
dispatch_web_service_request; end”
elsif klass.web_service_dispatching_mode == :layered
klass.class_eval ‘def api; dispatch_web_service_request;

In cases where the class is cached, it never is executed, and never
defines the api methods.

On Nov 27 2007, 9:59 am, Elliot Bowes <rails-mailing-l…@andreas-

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs