Hi
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
content:
class Api::ClientsController < ApplicationController
session :off
web_service_dispatching_mode :delegated
web_service :clients, ClientsService.new
end
There was then a corresponding API file in /app/apis/clients_service.rb
containing:
class ClientsAPI < ActionWebService::API::Base
inflect_names false
api_method :search, :expects => [{:query => :string}], :returns =>
[[Client::MiniClientRecord]]
end
class ClientsService < ActionWebService::Base
web_service_api ClientsAPI
def search(query)
return [] if query.blank?
return Client.search(query).collect {|c| c.to_client_record(true) }
end
end
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.
Regards,
Elliot