diff options
Diffstat (limited to 'actionwebservice/lib/action_web_service/client/xmlrpc_client.rb')
-rw-r--r-- | actionwebservice/lib/action_web_service/client/xmlrpc_client.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb b/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb index e0b7efc864..42b5c5d4f9 100644 --- a/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +++ b/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb @@ -30,20 +30,22 @@ module ActionWebService # :nodoc: def initialize(api, endpoint_uri, options={}) @api = api @handler_name = options[:handler_name] + @protocol = ActionWebService::Protocol::XmlRpc::XmlRpcProtocol.new @client = XMLRPC::Client.new2(endpoint_uri, options[:proxy], options[:timeout]) - @marshaler = WS::Marshaling::XmlRpcMarshaler.new end protected def perform_invocation(method_name, args) method = @api.api_methods[method_name.to_sym] - method.register_types(@marshaler) if method.expects && method.expects.length != args.length raise(ArgumentError, "#{method.public_name}: wrong number of arguments (#{args.length} for #{method.expects.length})") end - args = method.cast_expects(@marshaler, args) + args = method.cast_expects(args.dup) rescue args + if method.expects + method.expects.each_with_index{ |type, i| args[i] = @protocol.value_to_xmlrpc_wire_format(args[i], type) } + end ok, return_value = @client.call2(public_name(method_name), *args) - return method.cast_returns(@marshaler, return_value) if ok + return (method.cast_returns(return_value.dup) rescue return_value) if ok raise(ClientError, "#{return_value.faultCode}: #{return_value.faultString}") end |