diff options
Diffstat (limited to 'actionwebservice')
-rw-r--r-- | actionwebservice/CHANGELOG | 2 | ||||
-rw-r--r-- | actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb | 21 |
2 files changed, 14 insertions, 9 deletions
diff --git a/actionwebservice/CHANGELOG b/actionwebservice/CHANGELOG index b03bfeb508..a7bd6d77ec 100644 --- a/actionwebservice/CHANGELOG +++ b/actionwebservice/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fix duplicate XSD entries for custom types shared across delegated/layered services #1729 [Tyler Kovacs] + * Allow multiple invocations in the same test method #1720 [dkhawk] * Added ActionWebService::API::Base.soap_client and ActionWebService::API::Base.xmlrpc_client helper methods to create the internal clients for an API, useful for testing from ./script/console diff --git a/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb b/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb index d42851bf3b..8f04ed292c 100644 --- a/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +++ b/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb @@ -195,7 +195,7 @@ module ActionWebService # :nodoc: custom_types = [] apis.values.each do |api, bindings| bindings.each do |b| - custom_types << b + custom_types << b unless custom_types.include?(b) end end @@ -347,29 +347,32 @@ module ActionWebService # :nodoc: def register_api(api, marshaler) bindings = {} - traverse_custom_types(api, marshaler) do |binding| + traverse_custom_types(api, marshaler, bindings) do |binding| bindings[binding] = nil unless bindings.has_key?(binding) element_binding = binding.element_binding - bindings[binding.element_binding] = nil if element_binding && !bindings.has_key?(element_binding) + bindings[element_binding] = nil if element_binding && !bindings.has_key?(element_binding) end bindings.keys end - def traverse_custom_types(api, marshaler, &block) + def traverse_custom_types(api, marshaler, bindings, &block) api.api_methods.each do |name, method| expects, returns = method.expects, method.returns - expects.each{ |type| traverse_type(marshaler, type, &block) if type.custom? } if expects - returns.each{ |type| traverse_type(marshaler, type, &block) if type.custom? } if returns + expects.each{ |type| traverse_type(marshaler, type, bindings, &block) if type.custom? } if expects + returns.each{ |type| traverse_type(marshaler, type, bindings, &block) if type.custom? } if returns end end - def traverse_type(marshaler, type, &block) - yield marshaler.register_type(type) + def traverse_type(marshaler, type, bindings, &block) + binding = marshaler.register_type(type) + return if bindings.has_key?(binding) + bindings[binding] = nil + yield binding if type.array? yield marshaler.register_type(type.element_type) type = type.element_type end - type.each_member{ |name, type| traverse_type(marshaler, type, &block) } if type.structured? + type.each_member{ |name, type| traverse_type(marshaler, type, bindings, &block) } if type.structured? end end end |