diff options
author | Leon Breedt <bitserf@gmail.com> | 2005-04-02 21:03:36 +0000 |
---|---|---|
committer | Leon Breedt <bitserf@gmail.com> | 2005-04-02 21:03:36 +0000 |
commit | aaea48fe9826b9e5d2d5b92795a297b8f238c58d (patch) | |
tree | e7c01c7f95d467f837c1f96d58dac74c3c902610 /actionwebservice/lib/action_web_service/client/soap_client.rb | |
parent | aa09c770e9b5400683be11952673017295246de7 (diff) | |
download | rails-aaea48fe9826b9e5d2d5b92795a297b8f238c58d.tar.gz rails-aaea48fe9826b9e5d2d5b92795a297b8f238c58d.tar.bz2 rails-aaea48fe9826b9e5d2d5b92795a297b8f238c58d.zip |
* collapse 'ws' back into protocols, it just added complexity and indirection, and was hard to extend.
* extract casting into seperate support file
* ensure casting always does the right thing for return values, should fix interoperability issues with Ecto and possibly other XML-RPC clients
* add functional unit tests for scaffolding
* represent signature items with classes instead of symbols/Class objects, much more flexible
* tweak logging to always show casted versions of parameters and return values, if possible.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1072 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/lib/action_web_service/client/soap_client.rb')
-rw-r--r-- | actionwebservice/lib/action_web_service/client/soap_client.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/actionwebservice/lib/action_web_service/client/soap_client.rb b/actionwebservice/lib/action_web_service/client/soap_client.rb index b9eb0d11ad..c906a71331 100644 --- a/actionwebservice/lib/action_web_service/client/soap_client.rb +++ b/actionwebservice/lib/action_web_service/client/soap_client.rb @@ -46,8 +46,7 @@ module ActionWebService # :nodoc: @type_namespace = options[:type_namespace] || 'urn:ActionWebService' @method_namespace = options[:method_namespace] || 'urn:ActionWebService' @driver_options = options[:driver_options] || {} - @marshaler = WS::Marshaling::SoapMarshaler.new @type_namespace - @encoder = WS::Encoding::SoapRpcEncoding.new @method_namespace + @protocol = ActionWebService::Protocol::Soap::SoapProtocol.new @soap_action_base = options[:soap_action_base] @soap_action_base ||= URI.parse(endpoint_uri).path @driver = create_soap_rpc_driver(api, endpoint_uri) @@ -59,9 +58,9 @@ module ActionWebService # :nodoc: protected def perform_invocation(method_name, args) method = @api.api_methods[method_name.to_sym] - args = method.cast_expects(@marshaler, args) + args = method.cast_expects(args.dup) rescue args return_value = @driver.send(method_name, *args) - method.cast_returns(@marshaler, return_value) + method.cast_returns(return_value.dup) rescue return_value end def soap_action(method_name) @@ -70,9 +69,9 @@ module ActionWebService # :nodoc: private def create_soap_rpc_driver(api, endpoint_uri) - api.api_methods.each{ |name, method| method.register_types(@marshaler) } + @protocol.register_api(api) driver = SoapDriver.new(endpoint_uri, nil) - driver.mapping_registry = @marshaler.registry + driver.mapping_registry = @protocol.marshaler.registry api.api_methods.each do |name, method| qname = XSD::QName.new(@method_namespace, method.public_name) action = soap_action(method.public_name) @@ -81,15 +80,14 @@ module ActionWebService # :nodoc: param_def = [] i = 0 if expects - expects.each do |spec| - param_name = method.param_name(spec, i) - type_binding = @marshaler.lookup_type(spec) - param_def << ['in', param_name, type_binding.mapping] + expects.each do |type| + type_binding = @protocol.marshaler.lookup_type(type) + param_def << ['in', type.name, type_binding.mapping] i += 1 end end if returns - type_binding = @marshaler.lookup_type(returns[0]) + type_binding = @protocol.marshaler.lookup_type(returns[0]) param_def << ['retval', 'return', type_binding.mapping] end driver.add_method(qname, action, method.name.to_s, param_def) |