# How to return List in web services througth ActionWebService

**URL:** <https://www.ruby-forum.com/t/how-to-return-list-in-web-services-througth-actionwebservice/170937>\
**Category:** Rails\
**Created:** [June 24, 2009, 7:58am UTC](https://www.ruby-forum.com/t/how-to-return-list-in-web-services-througth-actionwebservice/170937 "2009-06-24T07:58:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamidraza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e9a140/32.png) [@hamidraza](https://www.ruby-forum.com/u/hamidraza)\
**Post date:** [June 24, 2009, 7:58am UTC](https://www.ruby-forum.com/t/how-to-return-list-in-web-services-througth-actionwebservice/170937/1 "2009-06-24T07:58:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hamidraza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e9a140/32.png) [@hamidraza](https://www.ruby-forum.com/u/hamidraza)\
**Post date:** [June 24, 2009, 10:14am UTC](https://www.ruby-forum.com/t/how-to-return-list-in-web-services-througth-actionwebservice/170937/2 "2009-06-24T10:14:50Z")

</div>

On Tue, Jun 23, 2009 at 10:58 PM, Hamid R. \<  
removed\_email\_address@domain.invalid\> wrote:

> ```
> :returns => [:boolean]
> 
> ```
> 
> and how to get that list.
> 
> ## thx in advance
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

How are you calling it and what error messages are you receiving?

-Conrad

---

<div class="post-metadata">

**Author:** ![hamidraza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e9a140/32.png) [@hamidraza](https://www.ruby-forum.com/u/hamidraza)\
**Post date:** [June 24, 2009, 10:40am UTC](https://www.ruby-forum.com/t/how-to-return-list-in-web-services-througth-actionwebservice/170937/3 "2009-06-24T10:40:32Z")

</div>

web\_client\_api :baby\_wise , :soap,  
“[http://localhost:3000/baby\_wise/api](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.
