I’m trying to write my first web service, essentially it’s “hello
world”.
I have an api:
class BackendApi < ActionWebService::API::Base
api_method :test,
:returns => [[:string]]
end
a service controller:
class BackendController < ApplicationController
wsdl_service_name ‘backend’
web_service_scaffold :invoke
def test
return [“hello”,“world”]
end
end
and a client controller
class DrawingsController < ApplicationController
web_client_api :backend, :soap, “http://localhost:3000/backend/api”
def index
x = backend.test
render_text “success”
end
end
As you can see from above this is running locally, and on a Webrick
server. If I exercise the service using
http://localhost:3000/backend/invoke it works fine. However if I use
the client, as in http://localhost:3000/drawings (using the index), it
just times out:
Here’s the trace:
/usr/lib/ruby/1.8/timeout.rb:54:in parse_header' /usr/lib/ruby/1.8/timeout.rb:56:in
timeout’
/usr/lib/ruby/1.8/timeout.rb:76:in timeout' /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:1464:in
parse_header’
/usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:1422:in
read_header' /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:1254:in
get_status’
/usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:466:in
do_get_header' /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:436:in
do_get_block’
/usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:370:in
conn_request' /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:285:in
request’
/usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:264:in
post' /usr/lib/ruby/1.8/soap/streamHandler.rb:170:in
send_post’
/usr/lib/ruby/1.8/soap/streamHandler.rb:109:in send' /usr/lib/ruby/1.8/soap/rpc/proxy.rb:170:in
route’
/usr/lib/ruby/1.8/soap/rpc/proxy.rb:141:in call' /usr/lib/ruby/1.8/soap/rpc/driver.rb:178:in
call’
/usr/lib/ruby/1.8/soap/rpc/driver.rb:232:in test' /usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/client/soap_client.rb:61:in
perform_invocation’
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/client/base.rb:15:in
method_missing' #{RAILS_ROOT}/app/controllers/drawings_controller.rb:7:in
index’
Can anyone spot what I’m doing wrong here? I’m going by the Agile book
and this part is a little lite on examples.
Thanks,
Gary