Webservice External XMLRPC

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" ?>Adddsdfsasafdasf’
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" ?>addhtmlsadfdsaffromdsafdsaf

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

Anybody an idea ?

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:

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:

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:

That would be great let me know

Okay for the records, the problem is the method call, it should be Add
:slight_smile:
Got i feel stupid :slight_smile: