1 |
cvsjoko |
1.1 |
<?xml version="1.0"?> |
2 |
|
|
<!DOCTYPE methoddef SYSTEM "rpc-method.dtd"> |
3 |
|
|
<!-- |
4 |
|
|
Generated automatically by etc\make_method v1.09, Fri May 31 04:39:52 2002 |
5 |
|
|
|
6 |
|
|
Any changes made here will be lost. |
7 |
|
|
--> |
8 |
|
|
<methoddef> |
9 |
|
|
<name>system.multicall</name> |
10 |
|
|
<version>1.0</version> |
11 |
|
|
<signature>array array</signature> |
12 |
|
|
<help> |
13 |
|
|
Execute a set of one or more procedure calls on the server as a single |
14 |
|
|
request. The only supported call signature takes an ARRAY of STRUCT values. |
15 |
|
|
Each STRUCT should have two members: |
16 |
|
|
|
17 |
|
|
methodName The name of the method/routine to invoke as a STRING |
18 |
|
|
params An ARRAY of the parameters to pass to the routine |
19 |
|
|
|
20 |
|
|
If the "params" member is absent, a call with no parameters is assumed. The |
21 |
|
|
ARRAY of parameters will be expanded prior to the call, otherwise all the |
22 |
|
|
called routines would have to have a signature allowing for a single ARRAY |
23 |
|
|
input. Thus, any routine taking such an input will have to nest it within an |
24 |
|
|
outer containing ARRAY. |
25 |
|
|
|
26 |
|
|
The return value is an ARRAY of the return values from the calls, or a fault |
27 |
|
|
response if one of the calls failed. Because the specification does not allow |
28 |
|
|
for faults as first-class datatypes, all other results are discarded upon an |
29 |
|
|
error, and any remaining calls will not get executed. |
30 |
|
|
</help> |
31 |
|
|
<code language="perl"> |
32 |
|
|
<![CDATA[ |
33 |
|
|
#!perl |
34 |
|
|
############################################################################### |
35 |
|
|
# |
36 |
|
|
# Sub Name: multicall |
37 |
|
|
# |
38 |
|
|
# Description: Execute multiple method calls in a single request |
39 |
|
|
# |
40 |
|
|
# Arguments: NAME IN/OUT TYPE DESCRIPTION |
41 |
|
|
# $srv in ref Server object instance |
42 |
|
|
# $list in ref List of struct's with the call |
43 |
|
|
# data within. |
44 |
|
|
# |
45 |
|
|
# Globals: None. |
46 |
|
|
# |
47 |
|
|
# Environment: None. |
48 |
|
|
# |
49 |
|
|
# Returns: Success: listref |
50 |
|
|
# Failure: fault object |
51 |
|
|
# |
52 |
|
|
############################################################################### |
53 |
|
|
sub multicall |
54 |
|
|
{ |
55 |
|
|
use strict; |
56 |
|
|
|
57 |
|
|
my $srv = shift; |
58 |
|
|
my $list = shift; |
59 |
|
|
|
60 |
|
|
my ($call, $subname, $params, $result, @results); |
61 |
|
|
|
62 |
|
|
my $name = $srv->{method_name}; |
63 |
|
|
|
64 |
|
|
for $call (@$list) |
65 |
|
|
{ |
66 |
|
|
unless (ref($call) eq 'HASH') |
67 |
|
|
{ |
68 |
|
|
return RPC::XML::fault->new(200, |
69 |
|
|
"$name: One of the array elements " . |
70 |
|
|
'passed in was not a struct'); |
71 |
|
|
} |
72 |
|
|
|
73 |
|
|
return RPC::XML::fault->new(310, |
74 |
|
|
"$name: Request was missing required " . |
75 |
|
|
'"methodName" member') |
76 |
|
|
unless ($subname = $call->{methodName}); |
77 |
|
|
return RPC::XML::fault->new(310, |
78 |
|
|
"$name: Recursive calling of $name not " . |
79 |
|
|
'allowed') |
80 |
|
|
if ($subname eq $name); |
81 |
|
|
|
82 |
|
|
$params = $call->{params} || []; |
83 |
|
|
return RPC::XML::fault->new(200, |
84 |
|
|
"$name: Request's value for \"params\" " . |
85 |
|
|
'was not an array') |
86 |
|
|
unless (ref($params) eq 'ARRAY'); |
87 |
|
|
|
88 |
|
|
$result = $srv->dispatch([ $subname, @$params ]); |
89 |
|
|
return $result if $result->is_fault; |
90 |
|
|
|
91 |
|
|
push @results, $result->value; |
92 |
|
|
} |
93 |
|
|
|
94 |
|
|
\@results; |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
__END__ |
98 |
|
|
]]></code> |
99 |
|
|
</methoddef> |