method
add_multicall
v2_1_10 -
Show latest stable
- Class:
XMLRPC::BasicServer
add_multicall()public
Adds the multi-call handler “system.multicall”.
# File lib/xmlrpc/server.rb, line 191
def add_multicall
add_handler("system.multicall", %(array array), "Multicall Extension") do |arrStructs|
unless arrStructs.is_a? Array
raise XMLRPC::FaultException.new(ERR_MC_WRONG_PARAM, "system.multicall expects an array")
end
arrStructs.collect {|call|
if call.is_a? Hash
methodName = call["methodName"]
params = call["params"]
if params.nil?
multicall_fault(ERR_MC_MISSING_PARAMS, "Missing params")
elsif methodName.nil?
multicall_fault(ERR_MC_MISSING_METHNAME, "Missing methodName")
else
if methodName == "system.multicall"
multicall_fault(ERR_MC_RECURSIVE_CALL, "Recursive system.multicall forbidden")
else
unless params.is_a? Array
multicall_fault(ERR_MC_WRONG_PARAM_PARAMS, "Parameter params have to be an Array")
else
ok, val = call_method(methodName, *params)
if ok
# correct return value
[val]
else
# exception
multicall_fault(val.faultCode, val.faultString)
end
end
end
end
else
multicall_fault(ERR_MC_EXPECTED_STRUCT, "system.multicall expected struct")
end
}
end # end add_handler
self
end Related methods
- Instance methods
- add_handler
- add_introspection
- add_multicall
- get_default_handler
- get_service_hook
- process
- set_default_handler
- set_service_hook
- Class methods
- new
- Private methods
-
call_method -
check_arity -
dispatch -
handle -
multicall_fault