aboutsummaryrefslogtreecommitdiffstats
path: root/actionwebservice/lib
diff options
context:
space:
mode:
authorLeon Breedt <bitserf@gmail.com>2005-02-19 09:07:35 +0000
committerLeon Breedt <bitserf@gmail.com>2005-02-19 09:07:35 +0000
commit5f3f44e76fdf465910b7c6521568bb6a1e8bd641 (patch)
tree5cb537bd1e1789f57ccc31e2f34e351b1c1ef0dc /actionwebservice/lib
parent418d487020d24e69b528fdbedfecb20a87f99fcb (diff)
downloadrails-5f3f44e76fdf465910b7c6521568bb6a1e8bd641.tar.gz
rails-5f3f44e76fdf465910b7c6521568bb6a1e8bd641.tar.bz2
rails-5f3f44e76fdf465910b7c6521568bb6a1e8bd641.zip
ensure clients can handle APIs with named parameter signatures,
and test for this git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@680 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/lib')
-rw-r--r--actionwebservice/lib/action_web_service/client/base.rb4
-rw-r--r--actionwebservice/lib/action_web_service/client/soap_client.rb5
-rw-r--r--actionwebservice/lib/action_web_service/client/xmlrpc_client.rb5
3 files changed, 10 insertions, 4 deletions
diff --git a/actionwebservice/lib/action_web_service/client/base.rb b/actionwebservice/lib/action_web_service/client/base.rb
index d01cffcd56..431b78c748 100644
--- a/actionwebservice/lib/action_web_service/client/base.rb
+++ b/actionwebservice/lib/action_web_service/client/base.rb
@@ -30,6 +30,10 @@ module ActionWebService # :nodoc:
nil
end
end
+
+ def lookup_class(klass)
+ klass.is_a?(Hash) ? klass.values[0] : klass
+ end
end
end
end
diff --git a/actionwebservice/lib/action_web_service/client/soap_client.rb b/actionwebservice/lib/action_web_service/client/soap_client.rb
index 3557f88594..dfabfd86ee 100644
--- a/actionwebservice/lib/action_web_service/client/soap_client.rb
+++ b/actionwebservice/lib/action_web_service/client/soap_client.rb
@@ -62,13 +62,14 @@ module ActionWebService # :nodoc:
if expects
expects.each do |klass|
param_name = klass.is_a?(Hash) ? klass.keys[0] : "param#{i}"
- mapping = @mapper.lookup(klass)
+ param_klass = lookup_class(klass)
+ mapping = @mapper.lookup(param_klass)
param_def << ['in', param_name, mapping.registry_mapping]
i += 1
end
end
if returns
- mapping = @mapper.lookup(returns[0])
+ mapping = @mapper.lookup(lookup_class(returns[0]))
param_def << ['retval', 'return', mapping.registry_mapping]
end
driver.add_method(qname, action, name.to_s, param_def)
diff --git a/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb b/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb
index df51230b81..bb52c20453 100644
--- a/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb
+++ b/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb
@@ -54,7 +54,7 @@ module ActionWebService # :nodoc:
signature = Protocol::XmlRpc::XmlRpcProtocol.transform_array_types(signature)
(1..signature.size).each do |i|
i -= 1
- params[i] = Protocol::XmlRpc::XmlRpcProtocol.ruby_to_xmlrpc(params[i], signature[i])
+ params[i] = Protocol::XmlRpc::XmlRpcProtocol.ruby_to_xmlrpc(params[i], lookup_class(signature[i]))
end
end
params
@@ -63,7 +63,8 @@ module ActionWebService # :nodoc:
def transform_return_value(method_name, return_value)
info = @api.api_methods[method_name.to_sym]
return true unless signature = info[:returns]
- signature = Protocol::XmlRpc::XmlRpcProtocol.transform_array_types(signature)
+ param_klass = lookup_class(signature[0])
+ signature = Protocol::XmlRpc::XmlRpcProtocol.transform_array_types([param_klass])
Protocol::XmlRpc::XmlRpcProtocol.xmlrpc_to_ruby(return_value, signature[0])
end