Ok, so I have an API definition as so... api_method :frame_out, :returns => [:boolean,:int,:int,:string,:string] and a controller method as follows... def frame_out return [false, 0, 0, '''',''''] end When I run this using the test scaffolding I get a "Don''t know how to cast Array into Boolean" Error. What am I doing wrong? Cheers. Dougal. -- 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 -~----------~----~----~----~------~----~------~--~---
cremes.devlist-ee4meeAH724@public.gmane.org
2006-Nov-16 14:26 UTC
Re: Web Services: Returning multiple values
On Nov 16, 2006, at 8:04 AM, Douglas Shearer wrote:> > Ok, so I have an API definition as so... > > api_method :frame_out, > :returns => [:boolean,:int,:int,:string,:string] > > and a controller method as follows... > > def frame_out > return [false, 0, 0, '''',''''] > end > > When I run this using the test scaffolding I get a "Don''t know how to > cast Array into Boolean" Error. > > What am I doing wrong?I think you need to try an additional level of indirection on your return value: :returns => [[:boolean, :int, :int, :string, :string]] This will return an array containing a boolean, two ints and two strings. Your prior definition didn''t do that. I think this is due to the peculiarity of how the syntax looks for the api definition. The first pair of brackets don''t actually define an array from the API standpoint. I''m not explaining this well... sorry. Just try the above and see if it fixes your problem. cr --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Chuck Remes wrote:> :returns => [[:boolean, :int, :int, :string, :string]]Oops, I wrote my code wrong, the controller method should in fact return a boolean, two ints and two strings... return true, 0, 0, '''', '''' This is how I would usually return multiple values to a method call. Unfortunately, I now get a "Don''t know how to cast String into Boolean" error. :o( Help is, and will be, appreciated. Ta. -- 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 -~----------~----~----~----~------~----~------~--~---
On 11/16/06, Douglas Shearer <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Chuck Remes wrote: > > > :returns => [[:boolean, :int, :int, :string, :string]] > > > Oops, I wrote my code wrong, the controller method should in fact > return a boolean, two ints and two strings... > > return true, 0, 0, '''', '''' > > This is how I would usually return multiple values to a method call. > Unfortunately, I now get a "Don''t know how to cast String into Boolean" > error. :o( > > Help is, and will be, appreciated. >AFAIK, SOAP doesn''t allow arrays of different types. You can introduce AWS::Struct class and use it as a returning value. -- Kent --- http://www.datanoise.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 -~----------~----~----~----~------~----~------~--~---