aboutsummaryrefslogtreecommitdiffstats
path: root/actionwebservice
diff options
context:
space:
mode:
authorLeon Breedt <bitserf@gmail.com>2005-08-14 18:43:39 +0000
committerLeon Breedt <bitserf@gmail.com>2005-08-14 18:43:39 +0000
commit2eba7134455863f936d0b1e8e88284c08ef6b083 (patch)
treedaed7ec8c967932a750206132b592fb74f374c22 /actionwebservice
parent056838d2fc959ab71f598dee8b8b0691608f8a72 (diff)
downloadrails-2eba7134455863f936d0b1e8e88284c08ef6b083.tar.gz
rails-2eba7134455863f936d0b1e8e88284c08ef6b083.tar.bz2
rails-2eba7134455863f936d0b1e8e88284c08ef6b083.zip
Fix duplicate XSD entries for custom types (#1729), and prevent recursive type
traversing. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2014 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice')
-rw-r--r--actionwebservice/CHANGELOG2
-rw-r--r--actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb21
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