ActionWebService with Rails 2.0

As of Rails 2.0 ActionWebService has been swapped out for the sexier ActiveResource. This is a great thing for most people as we’d all rather to use AR and HTTP as opposed to AWS and SOAP but sometimes third-party software integrations require SOAP…

The first thing to know is that AWS has been ousted to it’s new location.

So if you’re going to run a project requiring AWS on Edge Rails:

1) Freeze to Edge Rails

$ rake rails:freeze:edge

2) Freeze ousted AWS to vendor/gems

$ mkdir -p vendor/gems
$ svn export http://svn.rubyonrails.org/rails/ousted/actionwebservice vendor/gems/actionwebservice

3) Load AWS and dependent directories on boot

environment.rb

Rails::Initializer.run do |config|
  config.load_paths += %W( #{RAILS_ROOT}/app/apis )
  config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
    File.directory?(lib = "#{dir}/lib") ? lib : dir
  end
  ...
end

require 'actionwebservice'
...

4) Load lib needed for testing using :invoke

test/test_helper.rb

require 'action_web_service/test_invoke.rb'

Happy SOAPing…

Comment or question via
FYI: This post was migrated over from another blogging engine. If you encounter any issues please let me know on . Thanks.