Actionwebservice

I am just learning some about web service. But many guys still use
Java (Jws). But I wanna try ROR. There are less information about it.

I can’t get install plugin in the ROR 2.0.x. So I followed the
standard textbook(“Agile_Web_Development_With_Rails-2nd” and “Ruby on
Rails for PHP and Java Developers”) I almost finished it. However, I
can’t find my api (http://localhost:3001/hello/api : GET not
supported). Anybody can help me? Many thanks.

I wanna invoke simple web service from client(3000) to Server(3001,
web service in)

I start localserver: http://localhost:3000/helloadmin

Hello Web Service

This rails application tests a web service.

Name:( )

Get Message

submit and get errors:



NameError in HelloadminController#getMsg_client

uninitialized constant HelloadminController::HelloApi

RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace

D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/
lib/
active_support/dependencies.rb:477:in const_missing' #{RAILS_ROOT}/app/controllers/helloadmin_controller.rb:21:ingetMsg_client’

D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/
lib/
active_support/dependencies.rb:477:in const_missing' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1095:insend’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:1095:in perform_action_without_filters' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:632:incall_filter’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:619:in perform_action_without_benchmark' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:66:inperform_action_without_rescue’
D:/InstantRails1.7/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:66:inperform_action_without_rescue’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/rescue.rb:83:in perform_action' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:430:insend’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:430:in process_without_filters' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:624:inprocess_without_session_management_support’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/session_management.rb:114:in process' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:330:inprocess’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
dispatcher.rb:41:in dispatch' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/rails.rb:78:inprocess’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel/rails.rb:76:in synchronize' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/rails.rb:76:inprocess’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel.rb:618:in process_client' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:617:ineach’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel.rb:617:in process_client' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:736:inrun’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel.rb:736:in initialize' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:736:innew’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel.rb:736:in run' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:720:ininitialize’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel.rb:720:in new' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:720:inrun’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel/configurator.rb:271:in run' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/configurator.rb:270:ineach’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel/configurator.rb:270:in run' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ bin/mongrel_rails:127:inrun’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel/command.rb:211:in run' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ bin/mongrel_rails:243 D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/ lib/ active_support/dependencies.rb:488:inload’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/
lib/
active_support/dependencies.rb:488:in load' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/ lib/ active_support/dependencies.rb:342:innew_constants_in’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/
lib/
active_support/dependencies.rb:488:in load' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/ commands/servers/mongrel.rb:60 D:/InstantRails1.7/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:ingem_original_require’
D:/InstantRails1.7/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in require' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/ lib/ active_support/dependencies.rb:495:inrequire’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/
lib/
active_support/dependencies.rb:342:in new_constants_in' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/ lib/ active_support/dependencies.rb:495:inrequire’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
commands/server.rb:39
D:/InstantRails1.7/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in gem_original_require' D:/InstantRails1.7/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:inrequire’
script/server:3

D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/
lib/
active_support/dependencies.rb:477:in const_missing' #{RAILS_ROOT}/app/controllers/helloadmin_controller.rb:21:ingetMsg_client’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:1095:in send' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1095:inperform_action_without_filters’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:632:in call_filter' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:619:inperform_action_without_benchmark’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/benchmarking.rb:66:in
perform_action_without_rescue' D:/InstantRails1.7/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/benchmarking.rb:66:in
perform_action_without_rescue' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/rescue.rb:83:inperform_action’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:430:in send' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:430:inprocess_without_filters’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:624:in
process_without_session_management_support' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/session_management.rb:114:inprocess’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:330:in process' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/ dispatcher.rb:41:indispatch’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel/rails.rb:78:in process' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/rails.rb:76:insynchronize’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel/rails.rb:76:in process' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:618:inprocess_client’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel.rb:617:in each' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:617:inprocess_client’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel.rb:736:in run' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:736:ininitialize’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel.rb:736:in new' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:736:inrun’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel.rb:720:in initialize' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:720:innew’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel.rb:720:in run' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/configurator.rb:271:inrun’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
lib/mongrel/configurator.rb:270:in each' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/configurator.rb:270:inrun’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
bin/mongrel_rails:127:in run' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/command.rb:211:inrun’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/
bin/mongrel_rails:243
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/
lib/
active_support/dependencies.rb:488:in load' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/ lib/ active_support/dependencies.rb:488:inload’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/
lib/
active_support/dependencies.rb:342:in new_constants_in' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/ lib/ active_support/dependencies.rb:488:inload’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
commands/servers/mongrel.rb:60
D:/InstantRails1.7/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in gem_original_require' D:/InstantRails1.7/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:inrequire’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/
lib/
active_support/dependencies.rb:495:in require' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/ lib/ active_support/dependencies.rb:342:innew_constants_in’
D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/
lib/
active_support/dependencies.rb:495:in require' D:/InstantRails1.7/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/ commands/server.rb:39 D:/InstantRails1.7/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:ingem_original_require’
D:/InstantRails1.7/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in `require’
script/server:3

Request

Parameters: {“name”=>[“ww”], “commit”=>“Get Message”}

Show session dump


flash: !map:ActionController::Flash::FlashHash {}

Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}


My codes:

helloservice:

helloservice\app\apis:

class HelloApi < ActionWebService::API::Base
api_method :getMsg,
:expects => [{:name => :string}],
:returns => [[:string]]
end

helloservice\app\controllers

class HelloController < ApplicationController
wsdl_service_name ‘Hello’

web_service_api HelloApi
web_service_scaffold :invoke

def getMsg(name)
"Hello "+ name
end
end

helloadmin:

helloadmin\app\controllers

class HelloadminController < ApplicationController
def getMsg_client
hello_client = ActionWebService::Client::Soap.new(HelloApi,
http://localhost:3001/hello/api”)
@service_output = hello_client.getMsg(params[:name])
end
end

helloadmin\app\views\helloadmin

index.rhtml:

Hello Web Service

Hello Web Service

This rails application tests a web service.

<%= start_form_tag :action=> 'getMsg_client' %>

Name
<%= text_field 'name', '' %>

<%= submit_tag "Get Message" %> <%= end_form_tag %>

getMsg.rhtml:

Hello Web Service

<%= @service_output %>

I don’t understand why it is not working!!!

Ming

Check out

http://www.texperts.com/2007/12/21/using-action-web-service-with-rails-2
0/

if you are trying to get it to work on Rails 2.0

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs