The service file is named car_service.rb not node_service.rb. Sorry
about the extra post.
Bealach
On 8/24/06, Bealach Na Bo <bealach@gmail.com>
wrote:> Hi Folks,
>
> I''m having trouble with setting up web services with layered
> dispatching.
>
> I''ve defined my controller (backend_controller.rb) as:
>
> class BackendController < ApplicationController
> web_service_dispatching_mode :layered
> web_service_scaffold :invoke
>
> web_service (:car) {CarService.new}
>
> end
>
> and my service (node_service.rb) as:
>
>
> class CarApi < ActionWebService::API::Base
> api_method :find_all_cars,
> :returns => [[:int]]
>
> api_method :find_car_by_id,
> :expects => [:int],
> :returns => [Car]
>
> api_method :find_car_by_name,
> :expects => [:string],
> :returns => [[Car]]
>
> end
>
> class CarService < ActionWebService::Base
> web_service_api CarApi
>
> def find_all_cars
> Car.find(:all).map{ |car| car.id }
> end
>
> def find_car_by_id(id)
> Car.find(id)
> end
>
> def find_car_by_name(name)
> Car.find(:all,
> :conditions => ["name = ?", name])
> end
> end
>
> But when my external client (Perl Frontier::client) tries to use
>
> http://localhost:3000/backend/car (this is how it should look
> according to the Agile book)
>
> it fails with the following in the logs
>
> Processing BackendController#car (for 127.0.0.1 at 2006-08-24
> 09:59:54) [POST]
> Session ID: 4dbf6e1ffd1ab6764cce4e9f09927950
> Parameters: {"action"=>"car",
"controller"=>"backend",
>
"methodCall"=>{"methodName"=>"FindCarByName",
>
"params"=>{"param"=>{"value"=>{"string"=>"711N7013T1"}}}}}
>
>
> ActionController::UnknownAction (No action responded to car):
>
>
> I can''t, for the life of me, see what I''ve missed. Can
anyone help?
>
> Thanks,
>
> Bealach
>