i am having some problems accessing my web service from outside the
"invoke" functions..
i have the following backend_controller.rb (1) with this a
backend_api.rb (2)..
when i hit it with:
http://localhost:3000/backend/invoke
everything is fine..
when i try it in irb using (3) i get:
irb(main):316:0>
result=server.call("GetMailingList","ddd")
RuntimeError: HTTP-Error: 400 Bad Request
any ideas?
thanks in advance!
(1)
class BackendController < ApplicationController
web_service_dispatching_mode :direct
wsdl_service_name ''Backend''
web_service_api BackendApi
web_service_scaffold :invoke
def get_mailing_list(api_key)
key = SiteInfo.find(:first).api_key
unless api_key == key
return "Accesss Denied..."
end
list = Array.new
emails = EmailList.find(:all)
emails.each do |e|
unless e.email_address.blank?
list << e.email_address+"\n"
end
end
list.sort!
end
end
(2)
class BackendApi < ActionWebService::API::Base
api_method :get_mailing_list,
:expects => [:string],
:returns => [[:string]]
api_method :get_forward_optins
end
(3)
require ''xmlrpc/client''
server = XMLRPC::Client.new("http://localhost:3000/backend/api")
result = server.call("GetMailingList","ddd")
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---