diff options
Diffstat (limited to 'actionwebservice/lib')
-rw-r--r-- | actionwebservice/lib/action_web_service/dispatcher/abstract.rb | 11 | ||||
-rw-r--r-- | actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb | 13 |
2 files changed, 20 insertions, 4 deletions
diff --git a/actionwebservice/lib/action_web_service/dispatcher/abstract.rb b/actionwebservice/lib/action_web_service/dispatcher/abstract.rb index 96016ef67e..9c981e4ec1 100644 --- a/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +++ b/actionwebservice/lib/action_web_service/dispatcher/abstract.rb @@ -62,7 +62,7 @@ module ActionWebService # :nodoc: responses = [] invocations.each do |invocation| if invocation.is_a?(Hash) - responses << invocation + responses << [invocation, nil] next end begin @@ -74,15 +74,18 @@ module ActionWebService # :nodoc: end api_method = invocation.api_method if invocation.api.has_api_method?(api_method.name) + response_type = (api_method.returns ? api_method.returns[0] : nil) return_value = api_method.cast_returns(return_value) + else + response_type = ActionWebService::SignatureTypes.canonical_signature_entry(return_value.class, 0) end - responses << [return_value] + responses << [return_value, response_type] rescue Exception => e - responses << { 'faultCode' => 3, 'faultString' => e.message } + responses << [{ 'faultCode' => 3, 'faultString' => e.message }, nil] end end invocation = invocations[0] - invocation.protocol.encode_response('system.multicall', responses, nil, invocation.protocol_options) + invocation.protocol.encode_multicall_response(responses, invocation.protocol_options) end def web_service_invocation(request, level = 0) diff --git a/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb b/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb index 64992e7754..a3abc6a24d 100644 --- a/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +++ b/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb @@ -58,6 +58,19 @@ module ActionWebService # :nodoc: Response.new(raw_response, 'text/xml', return_value) end + def encode_multicall_response(responses, protocol_options={}) + result = responses.map do |return_value, return_type| + if return_value && return_type + return_value = value_to_xmlrpc_wire_format(return_value, return_type) + return_value = [return_value] unless return_value.nil? + end + return_value = false if return_value.nil? + return_value + end + raw_response = XMLRPC::Marshal.dump_response(result) + Response.new(raw_response, 'text/xml', result) + end + def protocol_client(api, protocol_name, endpoint_uri, options={}) return nil unless protocol_name == :xmlrpc ActionWebService::Client::XmlRpc.new(api, endpoint_uri, options) |