REST is very much the way forward as far as Rails in concerned, but there are still plenty of people who need to access a SOAP api, or who have to provide one to third parties. Rails 2.0 dropped Action Web Service from core, with the promise that all you had to do to get it back was to install the gem.
There’s a little more to it than gem install actionwebservice though, and this is what we did.
We checked out the source from http://svn.rubyonrails.org/rails/ousted/actionwebservice/ into our vendor/rails folder (we have all of the rails gems frozen there).
There are 2 things to do here.First, above the Rails::Initializer.run block put
class Rails::Configuration attr_accessor :action_web_service endNext, add
config.frameworks += [ :action_web_service] config.action_web_service = Rails::OrderedOptions.new config.load_paths += %W( #{RAILS_ROOT}/app/apis )This tells Rails that you do want to load Action Web Service, creates a thing for its settings to be contained in and makes Rails look in the apis folder when it needs to find an undefined constant.
Having done this your app should run. There’s one more thing left to do so that you can run your tests. Crack open your test_helper.rb file and add
require 'action_web_service/test_invoke'below where it says require 'test_help'. This essentially allows you to use the invoke method in your test cases.
Relax, make yourself a cup of tea. You’ve re-enabled SOAP in your Rails 2.0 app and it didn’t even take 5 minutes.