Forum: Ruby on Rails Webservice External XMLRPC

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.
C14805404d3f08ba9b1f6ad93c01615f?d=identicon&s=25 Daniel Wijnands (dewie)
on 2006-01-04 22:03
Hello i have some trouble getting my webservice to run .
I have the following webservice :

class DirectSpoolAPI < ActionWebService::API::Base
  api_method :add, :expects => [{:html=>:string},{:from=>:string}],
:returns => [Customer]
end

class DirectSpoolService < ActionWebService::Base
   web_service_api DirectSpoolAPI
   def add(html,from)
     Customer.find(:first)
   end

   def remove
   end
 end

class ApiController < ApplicationController
   skip_before_filter :login_required

   web_service_dispatching_mode :delegated
   web_service_scaffold :invoke
   web_service(:directspool) {DirectSpoolService.new}
 end

The controller behaves fine when accessing it with :
http://localhost:3003/api/invoke, and

curl -d '<?xml version="1.0"
?><methodCall><methodName>Add</methodName><params><param><value><string>dsdfsa</string></value></param><param><value><string>safdasf</string></value></param></params></methodCall>'
http://localhost:3003/api/directspool

But when i try to access it with the following script :

require "xmlrpc/client"

server = XMLRPC::Client.new("10.0.0.132", "/api/directspool", 3003)
begin
  param = server.call('add',:html=>'sadfdsaf',:from=>'dsafdsaf')
  puts "4 + 5 = #{param}"
rescue XMLRPC::FaultException => e
  puts "Error:"
  puts e.faultCode
  puts e.faultString
end

I get the following error :  no such method 'add' on API DirectSpoolAPI
The rails loggins says :

Processing ApiController#directspool (for 10.0.0.1 at 2006-01-04
22:04:03) [POST]
  Parameters: {"methodName"=>"add", "action"=>"directspool",
"params"=>{"param"=>{"value"=>{"struct"=>{"member"=>[{"name"=>"html",
"value"=>{"string"=>"sadfdsaf"}}, {"name"=>"from",
"value"=>{"string"=>"dsafdsaf"}}]}}}}, "controller"=>"api"}

Web Service Request: add({"html"=>"sadfdsaf", "from"=>"dsafdsaf"})
Entrypoint: directspool
  <?xml version="1.0"
?><methodCall><methodName>add</methodName><params><param><value><struct><member><name>html</name><value><string>sadfdsaf</string></value></member><member><name>from</name><value><string>dsafdsaf</string></value></member></struct></value></param></params></methodCall>


ActionWebService::Dispatcher::DispatcherError (no such method 'add' on
API DirectSpoolAPI):

Anybody an idea ?
C19a93a1264066e192ba91b7e44b9cfd?d=identicon&s=25 =?UTF-8?B?SMOhYmVyIErDoW5vcw==?= (Guest)
on 2006-01-04 23:02
(Received via mailing list)
Hi!

Interesting. I can't see any error , I tested in my machine and it's
work. Maybe,....if you modify the service try to restart webrick.

Cow

daniel wijnands írta:
C14805404d3f08ba9b1f6ad93c01615f?d=identicon&s=25 Daniel Wijnands (dewie)
on 2006-01-04 23:16
Hi ,

I have restated fcg and tried webrick.
Both no luck.

require "xmlrpc/client"

server = XMLRPC::Client.new("10.0.0.132", "/api/directspool", 3003)
begin
  param = server.call('add',:html=>'sadfdsaf',:from=>'dsafdsaf')
  puts "4 + 5 = #{param}"
rescue XMLRPC::FaultException => e
  puts "Error:"
  puts e.faultCode
  puts e.faultString
end

gives: no such method 'add' on API DirectSpoolAPI

daniel
=?UTF-8?B?SMOhYmVyIErDoW5vcw==?= wrote:
> Hi!
>
> Interesting. I can't see any error , I tested in my machine and it's
> work. Maybe,....if you modify the service try to restart webrick.
>
> Cow
>
> daniel wijnands írta:
C19a93a1264066e192ba91b7e44b9cfd?d=identicon&s=25 =?UTF-8?B?SMOhYmVyIErDoW5vcw==?= (Guest)
on 2006-01-05 01:00
(Received via mailing list)
Hi,

Interesting...
Here it's work.
I dunno why not work. Tomorrow I can try to write a service if you
publish it, and maybe we can found the solution.

Good Night

Cow

daniel wijnands írta:
C14805404d3f08ba9b1f6ad93c01615f?d=identicon&s=25 Daniel Wijnands (dewie)
on 2006-01-05 08:00
That would be great let me know
C14805404d3f08ba9b1f6ad93c01615f?d=identicon&s=25 Daniel Wijnands (dewie)
on 2006-01-05 12:02
Okay for the records, the problem is the method call, it should be Add
:)
Got i feel stupid :)
This topic is locked and can not be replied to.