Hamid Raza
2009-Jun-24 05:58 UTC
How to return List in web services througth ActionWebService
I need to return list of objects(e.g. users, articles etc) through ActionWebService::API::Base class BabyWiseApi < ActionWebService::API::Base api_method :is_new_update_available, :expects => [{:login=>:string}, {:lastUpdatePerformed=>:date}], :returns => [:boolean] api_method :get_baby_growth_articles, :expects => [{:userid=>:string}, {:lastUpdateDate=>:date}], :returns => [Article] api_method :get_quotes, :expects => [{:userid=>:string}, {:lastUpdateDate=>:date}], :returns => [:string] end this is how i m returning , it works fine at the server end. but when i write a client application to call the methods of web service there i have to define the same api class , like i mentioned up. the problem i m facing iz , in the client side it does recognize "Article" object as there is not any model defined at the clinet end. please tell me if there is any other way to return the list of objects and how to get that list. thx in advance -- Posted via http://www.ruby-forum.com/.
Conrad Taylor
2009-Jun-24 08:14 UTC
Re: How to return List in web services througth ActionWebService
On Tue, Jun 23, 2009 at 10:58 PM, Hamid Raza < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I need to return list of objects(e.g. users, articles etc) through > > ActionWebService::API::Base > > class BabyWiseApi < ActionWebService::API::Base > > api_method :is_new_update_available, > :expects => [{:login=>:string}, > {:lastUpdatePerformed=>:date}], > :returns => [:boolean] > > api_method :get_baby_growth_articles, > :expects => [{:userid=>:string}, {:lastUpdateDate=>:date}], > :returns => [Article] > > api_method :get_quotes, > :expects => [{:userid=>:string}, {:lastUpdateDate=>:date}], > :returns => [:string] > end > > > this is how i m returning , it works fine at the server end. > > but when i write a client application to call the methods of web service > there i have to define the same api class , like i mentioned up. > > the problem i m facing iz , in the client side it does recognize > "Article" object as there is not any model defined at the clinet end. > > > please tell me if there is any other way to return the list of objects > and how to get that list. > > thx in advance > -- > Posted via http://www.ruby-forum.com/. >How are you calling it and what error messages are you receiving? -Conrad --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hamid Raza
2009-Jun-24 08:40 UTC
Re: How to return List in web services througth ActionWebService
web_client_api :baby_wise , :soap, "http://localhost:3000/baby_wise/api", :service_name => ''baby_wise'' these are the properties i defined in the client controller and baby_wise.get_baby_growth_articles(params["user_id"],params[:new_update]["new_update"]) this is how m calling function of web service , and the api i already mentioned. it simply says that undefined method Article , simply it doesn''t recognize the Article object. as there isn''t any model with that name in the client end but it is in the server end therefore server side recognize it. -- Posted via http://www.ruby-forum.com/.