ActionWebService for many APIs in rails?

You create just one class API

dir: RAILS_ROOT/app/apis/myserver_api.rb class MyserverApi < ActionWebService::API::Base     api_method :list_products,                 :expects => [:string],                 :returns => [:string]

    api_method :list_users,                 :expects => [:string],                 :returns => [:string]

    api_method :list_orders,                 :expects => [:string],                 :returns => [:string]


dir: RAILS_ROOT/app/controller/myserver_controller.rb class MyserverController < ApplicationController      wsdl_service_name 'Myserver'      web_service_api MyserverApi

    def list_products(str)     end

    def list_users(str)     end

    def list_orders(str)     end end

In the api you put all the method that are in the controller and after you use your models inside your controller. You can do the job with one API class definition or you split in more for how many controllers you have.

Or if you already have your controllers done, you just need to write some API

api_method :list, :returns => [[:string]]

with this returns an array with one record for each row