Hi *, I need to pass a hash to a webservice, so I defined my API with: api_method :search, :expects => [{ :tags => :string, :assignment => :string, :resource => :string, :lesson_plan => :string, :subject => :string, :all_types => :string }], :returns => [[Resource]] when I try to test the webservice with scaffold the signature doesn''t seem to be correct: Resource[] Search(string subject) What''s happening here ? :) TIA, ngw -- Nicholas Wieland nicholas_wieland@yahoo.it -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060731/9f2978ce/attachment.html
Il giorno 31/lug/06, alle ore 10:54, Nicholas Wieland ha scritto:> Hi *, > I need to pass a hash to a webservice, so I defined my API with: > > api_method :search, > :expects => [{ > :tags => :string, > :assignment => :string, > :resource => :string, > :lesson_plan => :string, > :subject => :string, > :all_types => :string > }], :returns => [[Resource]] > > when I try to test the webservice with scaffold the signature > doesn''t seem to be correct: > > Resource[] Search(string subject) > > What''s happening here ? :)class ResourceApi < ActionWebService::API::Base api_method :search, :expects => [ {:tags => :string}, {:assignment => :string}, {:resource => :string}, {:lesson_plan => :string}, {:subject => :string}, {:all_types => :string}], :returns => [[Resource]] end This one works with xmlrpc, but not with SOAP. The error is "cannot map Array to SOAP/OM." Does someone know how to solve ? TIA, ngw -- Nicholas Wieland nicholas_wieland@yahoo.it -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060731/f0eda8aa/attachment.html
A exception stack trace and a small example would be helpful. On 7/31/06, Nicholas Wieland <nicholas_wieland@yahoo.it> wrote:> > > Il giorno 31/lug/06, alle ore 10:54, Nicholas Wieland ha scritto: > > Hi *, > I need to pass a hash to a webservice, so I defined my API with: > > api_method :search, > :expects => [{ > :tags => :string, > :assignment => :string, > :resource => :string, > :lesson_plan => :string, > :subject => :string, > :all_types => :string > }], :returns => [[Resource]] > > when I try to test the webservice with scaffold the signature doesn''t seem > to be correct: > > Resource[] Search(string subject) > > What''s happening here ? :) > > class ResourceApi < ActionWebService::API::Base > > api_method :search, > :expects => [ > {:tags => :string}, > {:assignment => :string}, > {:resource => :string}, > {:lesson_plan => :string}, > {:subject => :string}, > {:all_types => :string}], :returns => [[Resource]] > > > > end > > This one works with xmlrpc, but not with SOAP. > The error is "cannot map Array to SOAP/OM." > Does someone know how to solve ? > > TIA, > ngw > > -- > Nicholas Wieland > nicholas_wieland@yahoo.it > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Kent --- http://www.datanoise.com
Il giorno 31/lug/06, alle ore 16:32, Kent Sibilev ha scritto:> A exception stack trace and a small example would be helpful.Sure. The stack trace: /opt/local/lib/ruby/1.8/soap/mapping/registry.rb:468:in `_obj2soap'' /opt/local/lib/ruby/1.8/soap/mapping/registry.rb:420:in `obj2soap'' /opt/local/lib/ruby/1.8/soap/mapping/mapping.rb:127:in `_obj2soap'' /opt/local/lib/ruby/1.8/soap/mapping/mapping.rb:47:in `obj2soap'' /opt/local/lib/ruby/1.8/soap/mapping/mapping.rb:360:in `protect_threadvars'' /opt/local/lib/ruby/1.8/soap/mapping/mapping.rb:43:in `obj2soap'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/protocol/soap_protocol/marshaler.rb:35:in `ruby_to_soap'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/protocol/soap_protocol.rb:114:in `encode_response'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/dispatcher/abstract.rb:186:in `web_service_create_response'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/dispatcher/abstract.rb:59:in `web_service_invoke'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/dispatcher/abstract.rb:22:in `invoke_web_service_request'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/dispatcher/action_controller_dispatcher.rb:53:in `dispatch_web_service_request'' /opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/dispatcher/action_controller_dispatcher.rb:51:in `dispatch_web_service_request'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/scaffolding.rb:83:in `invoke_submit'' /opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/scaffolding.rb:67:in `invoke_submit'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/base.rb:910:in `perform_action_without_filters'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/filters.rb:368:in `perform_action_without_benchmark'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/rescue.rb:82:in `perform_action'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/base.rb:381:in `process_without_filters'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/filters.rb:377:in `process_without_session_management_support'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/session_management.rb:117:in `process'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher.rb:38:in `dispatch'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb: 115:in `handle_dispatch'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb: 81:in `service'' /opt/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /opt/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /opt/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /opt/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' /opt/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' /opt/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' /opt/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb: 67:in `dispatch'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/servers/ webrick.rb:59 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ active_support/dependencies.rb:147:in `require'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/server.rb:30 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ active_support/dependencies.rb:147:in `require'' script/server:3 -e:4 The search function needs a set of flags and a keyword (tags), it should search inside the db for matching records (Resource models) and return an array of Resource objects. I think the problem is the return value, but I don''t know how to fix that. I searched the documentation and I think it''s correct to use something like :returns => [[Resource]] for an array of Resource objects, and in fact it works like a charm with XML-RPC. The problem is soap ... Is this a rails bug ? ngw -- Nicholas Wieland nicholas_wieland@yahoo.it -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060731/fd878668/attachment-0001.html
On 7/31/06, Nicholas Wieland <nicholas_wieland@yahoo.it> wrote:> The search function needs a set of flags and a keyword (tags), it should > search inside the db for matching records (Resource models) and return an > array of Resource objects. > I think the problem is the return value, but I don''t know how to fix that. I > searched the documentation and I think it''s correct to use something like > :returns => [[Resource]] for an array of Resource objects, and in fact it > works like a charm with XML-RPC. The problem is soap ... > Is this a rails bug ?No. For an array of Resource objects you must specify :returns => [Resource] as a result signature. -- Kent --- http://www.datanoise.com
Il giorno 31/lug/06, alle ore 19:02, Kent Sibilev ha scritto:> On 7/31/06, Nicholas Wieland <nicholas_wieland@yahoo.it> wrote: >> The search function needs a set of flags and a keyword (tags), it >> should >> search inside the db for matching records (Resource models) and >> return an >> array of Resource objects. >> I think the problem is the return value, but I don''t know how to >> fix that. I >> searched the documentation and I think it''s correct to use >> something like >> :returns => [[Resource]] for an array of Resource objects, and in >> fact it >> works like a charm with XML-RPC. The problem is soap ... >> Is this a rails bug ? > > No. For an array of Resource objects you must specify > > :returns => [Resource] > > as a result signature.Thanks a lot for your help, but it doesn''t work ... The error is "Don''t know how to cast Array to Resource". /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/casting.rb:129:in `cast_to_structured_type'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/casting.rb:60:in `cast'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/casting.rb:38:in `cast_returns'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/casting.rb:25:in `cast_returns'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/api.rb:193:in `cast_returns'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/dispatcher/abstract.rb:182:in `web_service_create_response'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/dispatcher/abstract.rb:59:in `web_service_invoke'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/dispatcher/abstract.rb:22:in `invoke_web_service_request'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/dispatcher/action_controller_dispatcher.rb:53:in `dispatch_web_service_request'' /opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/dispatcher/action_controller_dispatcher.rb:51:in `dispatch_web_service_request'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/scaffolding.rb:83:in `invoke_submit'' /opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /opt/local/lib/ruby/gems/1.8/gems/actionwebservice-1.1.4/lib/ action_web_service/scaffolding.rb:67:in `invoke_submit'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/base.rb:910:in `perform_action_without_filters'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/filters.rb:368:in `perform_action_without_benchmark'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/rescue.rb:82:in `perform_action'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/base.rb:381:in `process_without_filters'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/filters.rb:377:in `process_without_session_management_support'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/ action_controller/session_management.rb:117:in `process'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher.rb:38:in `dispatch'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb: 115:in `handle_dispatch'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb: 81:in `service'' /opt/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /opt/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /opt/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /opt/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' /opt/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' /opt/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' /opt/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb: 67:in `dispatch'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/servers/ webrick.rb:59 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ active_support/dependencies.rb:147:in `require'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/server.rb:30 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ active_support/dependencies.rb:147:in `require'' script/server:3 -e:4 TIA, ngw -- Nicholas Wieland nicholas_wieland@yahoo.it -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060731/f9d17289/attachment.html