Joerg Diekmann
2006-Jan-30 10:29 UTC
[Rails] Arrays of objects as parameters to webservices
I think I am missing something terribly obvious. Is it possible to have an :expects parameter for a webservice that is an array of objects? I want to have a single webservice that expects all my line items (for an order). Is this something that is possible? -- Posted via http://www.ruby-forum.com/.
Joerg Diekmann wrote:> I think I am missing something terribly obvious. Is it possible to have > an :expects parameter for a webservice that is an array of objects? I > want to have a single webservice that expects all my line items (for an > order). Is this something that is possible?Hello, almost a year later I''m having the same problem :) I need to pass several parameters to a webservice, one of which is an array of structs. I tried to define it like this: api_method :profile_companies, :expects => [{:province => :string},{:area => :string},{:city => :string},{:postal_code => :string},[ProfileConditionStruct]], :returns => [[CompanyStruct]] where ProfileConditionStruct and CompanyStruct are simple structs, no complex types involved inside of them. the method is defined in the controller, then I call the service from a test: invoke :profile_companies, ''yada'', ''yada'', ''yada'', ''yada'', [c1, c2] where c1 and c2 are of type ProfileConditionStruct. What I get is: test_profile_companies(ExternalControllerApiTest): ActionWebService::Protocol::ProtocolError: Failed to parse SOAP request message /usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.6/lib/action_web_service/protocol/soap_protocol.rb:86:in `decode_response'' /usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.6/lib/action_web_service/test_invoke.rb:60:in `decode_rpc_response'' /usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.6/lib/action_web_service/test_invoke.rb:11:in `invoke'' ./test/functional/external_api_test.rb:21:in `test_profile_companies'' help anybody please? :) -- Cheers, Agnieszka -- 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 -~----------~----~----~----~------~----~------~--~---
Agnieszka Figiel wrote:> Joerg Diekmann wrote: >> I think I am missing something terribly obvious. Is it possible to have >> an :expects parameter for a webservice that is an array of objects? I >> want to have a single webservice that expects all my line items (for an >> order). Is this something that is possible? > > Hello, > > almost a year later I''m having the same problem :)Hello again, it seems my problem is connected with something different and not array parameters. I''ll report back when I figure that one out and get it working so that others have better chances of finding a useful example. -- Agnieszka -- 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 -~----------~----~----~----~------~----~------~--~---
Agnieszka Figiel wrote:> Agnieszka Figiel wrote: > Hello again, it seems my problem is connected with something different > and not array parameters. I''ll report back when I figure that one out > and get it working so that others have better chances of finding a > useful example. >just for the record, the code above was ok, the problem was caused by http authentication in the webservices controller. I still don''t know how to fix this otherwise than to turn authentication off to see the tests pass:), I''m referencing the problem in a separate post. -- Agnieszka Figiel -- 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 -~----------~----~----~----~------~----~------~--~---