Forum: Ruby on Rails ActionWebService

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
akbet (Guest)
on 2008-10-20 02:01
(Received via mailing list)
Good Day,

I use ActionWebService  for creation Blog API trough creation XMLRPC
controller

class XmlrpcController < ApplicationController
  web_service_dispatching_mode :layered

  web_service(:blogger)     { BloggerService.new() }
end

class BloggerAPI < ActionWebService::API::Base
  inflect_names false

  api_method :newPost, :returns => [:string], :expects => [
    {:appkey=>:string},
    {:blogid=>:string},
    {:username=>:string},
    {:password=>:string},
    {:content=>:string},
    {:publish=>:bool}
  ]

end

class BloggerService < ActionWebService::Base
  web_service_api BloggerAPI

  def initialize
    @postid = 0
  end

  def newPost(key, id, user, pw, content, publish)
    $stderr.puts "id=#{id} user=#{user} pw=#{pw},
content=#{content.inspect} [#{publish}]"
    (@postid += 1).to_s
  end

end

in Routes.rb I have row: map.connect "/xmlrpc/api", :controller =>
"xmlrpc", :action => "api"

When I use development environment with set in config/
development.rb:    config.cache_classes = false

For first call to blog API - I always take:

ActionController::UnknownAction (No action responded to api. Actions:
access_denied, authorization_failure!, authorized?, current_user,
current_user=, current_user?, login_from_cookie, login_required,
protected?, reject_unconfirmed_user, render_without_selector,
store_location, stub_user, and wsdl):
    /vendor/rails/actionpack/lib/action_controller/filters.rb:617:in
`call_filters'
.........

But next call always processed correct.

When I use production environment with set in config/production.rb:
config.cache_classes = true

I always take: ActionController::UnknownAction

How I can correct that?

Thanks
akbet (Guest)
on 2008-10-24 23:23
(Received via mailing list)
May be that will usefully for some body.

For start correct work,
I changed:

  class XmlrpcController < ApplicationController

to

class XmlrpcController < ActionController::Base
Victor N. (Guest)
on 2010-12-02 15:57
I was able to fix it.

ActionWebService is located in

vendor/plugins/datanoise-actionwebservice-c076ac1

$ ls vendor/plugins/datanoise-actionwebservice-c076ac1
actionwebservice.gemspec
CHANGELOG
examples
generators
install.rb
lib
MIT-LICENSE
Rakefile
README
setup.rb
test
TODO

I've added a new file

vendor/plugins/datanoise-actionwebservice-c076ac1/init.rb

with the following line:

require 'actionwebservice'

After this change I've got the following error:

uninitialized constant
ActionWebService::Dispatcher::ActionController::RoutingError (NameError)
  from
/home/vir/work/mmsd_iface/app/controllers/application_controller.rb:22

I've fixed it by replacing all occurances of ActionController module
with "::ActionController". With double colon I explicitly stated that
it's a top-level module.

After this change everything worked fine.
This topic is locked and can not be replied to.