Permalink
Browse files

special-case non-existent target method handling for 'system.multical…

…l' calls when the

method does not exist, to conform to the RFC and return the error inline in the multicall response.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2023 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 9d79880 commit fbba128f73e9a297ca6252c85d3c42b34241ff2f @leonbreedt leonbreedt committed Aug 16, 2005
@@ -62,6 +62,10 @@ def web_service_invoke(invocation)
def xmlrpc_multicall_invoke(invocations)
responses = []
invocations.each do |invocation|
+ if invocation.is_a?(Hash)
+ responses << invocation
+ next
+ end
begin
case web_service_dispatching_mode
when :direct
@@ -120,7 +124,11 @@ def web_service_invocation(request, level = 0)
multicall_request = request.dup
multicall_request.method_name = method_name
multicall_request.method_params = params
- web_service_invocation(multicall_request, level + 1)
+ begin
+ web_service_invocation(multicall_request, level + 1)
+ rescue Exception => e
+ {'faultCode' => 4, 'faultMessage' => e.message}
+ end
end
end
end
@@ -26,15 +26,19 @@ def test_multicall
{'methodName' => 'mt.bool'},
{'methodName' => 'blogger.str', 'params' => ['2000']},
{'methodName' => 'mt.alwaysFail'},
- {'methodName' => 'blogger.alwaysFail'}
+ {'methodName' => 'blogger.alwaysFail'},
+ {'methodName' => 'mt.blah'},
+ {'methodName' => 'blah.blah'}
])
assert_equal [
[["mtCat1", "mtCat2"]],
[["bloggerCat1", "bloggerCat2"]],
[true],
["2500"],
{"faultCode" => 3, "faultString" => "MT AlwaysFail"},
- {"faultCode" => 3, "faultString" => "Blogger AlwaysFail"}
+ {"faultCode" => 3, "faultString" => "Blogger AlwaysFail"},
+ {"faultCode" => 4, "faultMessage" => "no such method 'blah' on API DispatcherTest::MTAPI"},
+ {"faultCode" => 4, "faultMessage" => "no such web service 'blah'"}
], response
end

0 comments on commit fbba128

Please sign in to comment.