Dear RoR experts,
I have trouble calling RoR ActionWebservice without the Invoke
Scaffolding. I’d no problem testing the webservice using Invoke
Scaffolding. I’ve used the SOAP n XML-RPC and no problem geting the
results. I’m currently using Delegated despatch mode (coz i want to
access this service through third-party easily) but when i called the
web service using “http://localhost:3000/calc/api” this is what my app
log (log/development.log) and my web browser returned :
Processing CalcController#api (for 127.0.0.1 at 2006-08-23 15:16:20)
[GET]
Session ID: edce479c8c82f9c91a3f9d295897b4c5
Parameters: {“action”=>“api”, “controller”=>“calc”}
RuntimeError (NilClass is not a valid input stream. It must be
either a String, IO, StringIO or Source.):
/usr/local/lib/ruby/1.8/rexml/parsers/baseparser.rb:133:in stream=' /usr/local/lib/ruby/1.8/rexml/parsers/baseparser.rb:100:in
initialize’
/usr/local/lib/ruby/1.8/rexml/parsers/streamparser.rb:6:in initialize' /usr/local/lib/ruby/1.8/rexml/document.rb:173:in
parse_stream’
/usr/local/lib/ruby/1.8/xmlrpc/parser.rb:717:in parse' /usr/local/lib/ruby/1.8/xmlrpc/parser.rb:475:in
parseMethodCall’
/usr/local/lib/ruby/1.8/xmlrpc/marshal.rb:63:in load_call' /usr/local/lib/ruby/1.8/xmlrpc/marshal.rb:32:in
load_call’
/usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_ser
vice/protocol/xmlrpc_protocol.rb:36:in
decode_request' /usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_ser vice/protocol/xmlrpc_protocol.rb:32:in
decode_action_pack_request’
/usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_ser
vice/protocol/discovery.rb:20:in
discover_web_service_request' /usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_ser vice/protocol/discovery.rb:18:in
discover_web_service_request’
/usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_ser
vice/dispatcher/action_controller_dispatcher.rb:44:in
dispatch_web_service_request' (eval):1:in
api’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/b
ase.rb:910:in
perform_action_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/f ilters.rb:368:in
perform_action_without_benchmark’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/b
enchmarking.rb:69:in
perform_action_without_rescue' /usr/local/lib/ruby/1.8/benchmark.rb:293:in
measure’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/b
enchmarking.rb:69:in
perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/r escue.rb:82:in
perform_action’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/b
ase.rb:381:in
process_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/f ilters.rb:377:in
process_without_session_management_support’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/s
ession_management.rb:117:in
process' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
dispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in
handle_dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in
service’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in
run’
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in
start_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in
start’
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in
start’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2 /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.3.1/lib/active_support/de
pendencies.rb:147:in
require' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 /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.3.1/lib/active_support/de
pendencies.rb:147:in
`require’
./script/server:3
Completed in 0.00908 (110 reqs/sec) | 500 Internal Protocol Error [
http://localhost/calc/api]
Here are my source codes :
[[ api/calc_api.rb ]]
class CalcApi < ActionWebService::API::Base
api_method :add,
:expects => [:int,:int],
:returns => [:int]
end
[[ controllers/calc_controller.rb ]]
class CalcController < ApplicationController
web_service_dispatching_mode :delegated
web_service :calcservice2, CalcService.new
web_service_scaffold :invoke
end
[[ models/calc_service.rb ]]
class CalcService < ActionWebService::Base
web_service_api CalcApi
def add (a,b)
return a+b
end
end
N can anybody help me how to call RoR webservice from .NET / Java / PHP
client ?
Thank you
Amri H.