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 ?
--
Posted via http://www.ruby-forum.com/.
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:> 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
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:
--
Posted via http://www.ruby-forum.com/.
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:> 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: >> > > >
That would be great let me know -- Posted via http://www.ruby-forum.com/.