Web serveces problem

Hi,
I’m trying to added layered web services to my application and from some
reason it’s not working for me. i’m working with ruby 1.84, rails 1.0.

here are my files:

  1. app/apis/kate_api.rb:

class KateAPI < ActionWebService::API::Base
inflect_names false
api_method :check_version, :expects => [:string], :returns => [:string]
end

  1. app/models/kate_api_service.rb : (tried to put it also in apis
    directory - where should it be??)

class KateAPIService < ActionWebService::Base
web_service_api KateAPI

def check_version (version)
	if version != '0.25'
		'you are trying to talk with Tyra version 0.25 with a different 

version !’
else
‘server and client versions match - 0.25’
end
end
end

  1. app/controller/kate_controller.rb:

class KateController < ApplicationController
web_service_scaffold :invoke
web_service_dispatching_mode :layered
web_service :kate, KateAPIService.check_version
end

when I go to the browser to /myapp/kate/api i get:
NoMethodError in #
undefined method `check_version’ for KateAPIService:Class

and in the log:
oMethodError (undefined method check_version' for KateAPIService:Class): .//app/controllers/kate_controller.rb:6 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:207:inload’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:39:in
require_or_load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:22:independ_on’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:178:in
require_dependency' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:134:inload_file!’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:97:in
const_load!' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:80:inconst_load!’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:72:in
const_missing' routing.rb:234:intraverse_to_controller’
generated/routing/recognition.rb:7:in eval' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/routing.rb:234:intraverse_to_controller’
generated/routing/recognition.rb:7:in recognize_path' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/routing.rb:458:inrecognize!’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:117:inhandle_dispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:83:in
service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/local/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:95:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:23:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in start' /usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:69:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/servers/webrick.rb:59
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:inrequire’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/server.rb:28
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:inrequire’
./script/server:3

any help would be appriciated. I’ve wasted lots of time on this…
Thanks,
Amir.

Your controller should look like:

class KateController < ApplicationController
web_service_scaffold :invoke
web_service_dispatching_mode :layered
web_service :kate, KateAPIService.new
end

On 3/2/06, amir lidor [email protected] wrote:

end
version !’
web_service_dispatching_mode :layered
.//app/controllers/kate_controller.rb:6
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:97:in
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/routing.rb:458:in
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in start_thread' require’
Amir.


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Kent