line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=pod |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
WSDL::Generator::Base - Base class for WSDL::Generator::* |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use base 'WSDL::Generator::Base'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
package WSDL::Generator::Base; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
15
|
1
|
|
|
1
|
|
5
|
use warnings::register; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
100
|
|
16
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1197
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our %WSDL = ( |
21
|
|
|
|
|
|
|
ELEMENT => [ '' ], |
22
|
|
|
|
|
|
|
ARRAYREF => [ '' ], |
23
|
|
|
|
|
|
|
HASHREF => [ |
24
|
|
|
|
|
|
|
'', |
25
|
|
|
|
|
|
|
[ |
26
|
|
|
|
|
|
|
'', |
27
|
|
|
|
|
|
|
['@[%elements%]'], |
28
|
|
|
|
|
|
|
'', |
29
|
|
|
|
|
|
|
], |
30
|
|
|
|
|
|
|
'', |
31
|
|
|
|
|
|
|
], |
32
|
|
|
|
|
|
|
TYPES => [ |
33
|
|
|
|
|
|
|
'', |
34
|
|
|
|
|
|
|
[ |
35
|
|
|
|
|
|
|
'', |
36
|
|
|
|
|
|
|
['@[%schema%]'], |
37
|
|
|
|
|
|
|
'', |
38
|
|
|
|
|
|
|
], |
39
|
|
|
|
|
|
|
'', |
40
|
|
|
|
|
|
|
], |
41
|
|
|
|
|
|
|
MESSAGE => [ |
42
|
|
|
|
|
|
|
'', |
43
|
|
|
|
|
|
|
[ '' ], |
44
|
|
|
|
|
|
|
'', |
45
|
|
|
|
|
|
|
], |
46
|
|
|
|
|
|
|
PORTTYPE_OPERATION => |
47
|
|
|
|
|
|
|
[ '', |
48
|
|
|
|
|
|
|
[ |
49
|
|
|
|
|
|
|
'', |
50
|
|
|
|
|
|
|
'', |
51
|
|
|
|
|
|
|
], |
52
|
|
|
|
|
|
|
'', |
53
|
|
|
|
|
|
|
], |
54
|
|
|
|
|
|
|
PORTTYPE => [ |
55
|
|
|
|
|
|
|
'', |
56
|
|
|
|
|
|
|
['@[%porttype_operation%]'], |
57
|
|
|
|
|
|
|
'', |
58
|
|
|
|
|
|
|
], |
59
|
|
|
|
|
|
|
BINDING_OPERATION => |
60
|
|
|
|
|
|
|
[ |
61
|
|
|
|
|
|
|
'', |
62
|
|
|
|
|
|
|
[ |
63
|
|
|
|
|
|
|
'', |
64
|
|
|
|
|
|
|
'', |
65
|
|
|
|
|
|
|
[ '' ], |
66
|
|
|
|
|
|
|
'', |
67
|
|
|
|
|
|
|
' |
68
|
|
|
|
|
|
|
[ '' ], |
69
|
|
|
|
|
|
|
'', |
70
|
|
|
|
|
|
|
], |
71
|
|
|
|
|
|
|
'', |
72
|
|
|
|
|
|
|
], |
73
|
|
|
|
|
|
|
BINDING => |
74
|
|
|
|
|
|
|
[ |
75
|
|
|
|
|
|
|
'', |
76
|
|
|
|
|
|
|
[ |
77
|
|
|
|
|
|
|
'', |
78
|
|
|
|
|
|
|
['@[%binding_operation%]'], |
79
|
|
|
|
|
|
|
], |
80
|
|
|
|
|
|
|
'', |
81
|
|
|
|
|
|
|
], |
82
|
|
|
|
|
|
|
SERVICE => |
83
|
|
|
|
|
|
|
[ |
84
|
|
|
|
|
|
|
'', |
85
|
|
|
|
|
|
|
[ |
86
|
|
|
|
|
|
|
'', |
87
|
|
|
|
|
|
|
[ |
88
|
|
|
|
|
|
|
'[%documentation%]', |
89
|
|
|
|
|
|
|
], |
90
|
|
|
|
|
|
|
'', |
91
|
|
|
|
|
|
|
'', |
92
|
|
|
|
|
|
|
[ |
93
|
|
|
|
|
|
|
'', |
94
|
|
|
|
|
|
|
], |
95
|
|
|
|
|
|
|
'', |
96
|
|
|
|
|
|
|
], |
97
|
|
|
|
|
|
|
'', |
98
|
|
|
|
|
|
|
], |
99
|
|
|
|
|
|
|
DEFINITIONS => |
100
|
|
|
|
|
|
|
[ |
101
|
|
|
|
|
|
|
'', |
102
|
|
|
|
|
|
|
['@[%schema%]'], |
103
|
|
|
|
|
|
|
['@[%message%]'], |
104
|
|
|
|
|
|
|
['@[%porttype%]'], |
105
|
|
|
|
|
|
|
['@[%binding%]'], |
106
|
|
|
|
|
|
|
['@[%service%]'], |
107
|
|
|
|
|
|
|
'', |
108
|
|
|
|
|
|
|
], |
109
|
|
|
|
|
|
|
WSDL => |
110
|
|
|
|
|
|
|
[ |
111
|
|
|
|
|
|
|
'', |
112
|
|
|
|
|
|
|
'@[%definitions%]', |
113
|
|
|
|
|
|
|
], |
114
|
|
|
|
|
|
|
); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=pod |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 METHODS |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 get_wsdl_element($param, $tab) |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
$param contains the parameters to parse the element template. |
123
|
|
|
|
|
|
|
$tab is the depth of the structure - optional - useful for indented display. |
124
|
|
|
|
|
|
|
Returns an array of elements ready to be displayed. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub get_wsdl_element { |
129
|
47
|
|
|
47
|
1
|
68
|
my ($self, $param, $depth) = @_; |
130
|
47
|
100
|
100
|
|
|
166
|
$param->{min_occur} = 1 unless (exists $param->{min_occur} and defined $param->{min_occur}); |
131
|
47
|
100
|
66
|
|
|
155
|
$param->{max_occur} = 1 unless (exists $param->{max_occur} and defined $param->{max_occur}); |
132
|
47
|
|
50
|
|
|
139
|
$depth ||= 0; |
133
|
47
|
|
|
|
|
85
|
my $element = $WSDL{$param->{wsdl_type}}; |
134
|
47
|
|
|
|
|
121
|
my @return = $self->get_wsdl_element_recurse($param, $element, $depth - 1); |
135
|
47
|
|
|
|
|
279
|
return bless \@return => ref($self); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=pod |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 to_string() |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Returns a string containing lines of WSDL data |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
sub to_string { |
146
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
147
|
1
|
|
|
|
|
3
|
my $string = ''; |
148
|
1
|
|
|
|
|
2
|
foreach ( @$self ) { |
149
|
124
|
|
|
|
|
261
|
$string .= "\t" x $_->{depth} . $_->{content} . "\n"; |
150
|
|
|
|
|
|
|
} |
151
|
1
|
|
|
|
|
83
|
return $string; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=pod |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 dumper($struct) |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Extends the data structure received by adding data type infos at each branch |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=cut |
162
|
|
|
|
|
|
|
sub dumper { |
163
|
42
|
|
|
42
|
1
|
58
|
my ($self, $param) = @_; |
164
|
42
|
|
|
|
|
55
|
my $branch = {}; |
165
|
42
|
|
|
|
|
56
|
my $ref = ref($param); |
166
|
42
|
100
|
|
|
|
83
|
if (! $ref) { |
|
|
100
|
|
|
|
|
|
167
|
26
|
|
|
|
|
55
|
$branch->{type} = 'SCALAR'; |
168
|
26
|
|
|
|
|
43
|
$branch->{value} = $param; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
elsif ($ref eq 'ARRAY') { |
171
|
7
|
50
|
|
|
|
12
|
if (@$param) { |
172
|
7
|
|
|
|
|
14
|
$branch->{type} = 'ARRAYREF'; |
173
|
7
|
|
|
|
|
11
|
foreach my $elem (@$param) { |
174
|
17
|
|
|
|
|
21
|
push @{$branch->{value}}, $self->dumper($elem); |
|
17
|
|
|
|
|
57
|
|
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
else { |
178
|
0
|
|
|
|
|
0
|
$branch->{type} = 'SCALAR'; |
179
|
0
|
|
|
|
|
0
|
$branch->{value} = undef; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
else { |
183
|
9
|
|
|
|
|
17
|
$branch->{type} = 'HASHREF'; |
184
|
9
|
|
|
|
|
24
|
foreach my $key (keys %$param) { |
185
|
19
|
|
|
|
|
39
|
$branch->{value}->{$key} = $self->dumper($param->{$key}); |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
} |
188
|
42
|
|
|
|
|
129
|
return $branch; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub get_wsdl_element_recurse { |
193
|
90
|
|
|
90
|
0
|
121
|
my ($self, $param, $array, $depth) = @_; |
194
|
90
|
|
|
|
|
81
|
$depth++; |
195
|
90
|
|
|
|
|
107
|
my @lines = (); |
196
|
90
|
|
|
|
|
128
|
foreach my $elt (@$array) { |
197
|
182
|
100
|
|
|
|
304
|
if (ref $elt) { |
198
|
43
|
|
|
|
|
116
|
push @lines, $self->get_wsdl_element_recurse($param, $elt, $depth); |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
else { |
201
|
139
|
|
|
|
|
149
|
my $parsed = $elt; |
202
|
139
|
100
|
66
|
|
|
405
|
if ($parsed =~ /^\@\[%(.+?)%\]/ and ref $param->{$1}) { |
203
|
15
|
|
|
|
|
16
|
foreach my $element ( @{$param->{$1}} ) { |
|
15
|
|
|
|
|
31
|
|
204
|
346
|
|
|
|
|
386
|
my $parsed2 = $parsed; |
205
|
346
|
|
|
|
|
1488
|
$parsed2 =~ s/\@\[%(.+?)%\]/$element->{content}/gi; |
206
|
346
|
|
|
|
|
1361
|
push @lines, { content => $parsed2, |
207
|
|
|
|
|
|
|
depth => $element->{depth}+$depth }; |
208
|
|
|
|
|
|
|
} |
209
|
15
|
|
|
|
|
56
|
$parsed =~ s/\@\[%(.+?)%\]//g; |
210
|
15
|
50
|
|
|
|
53
|
if ($parsed =~ s/\[%(.+?)%\]/$param->{$1}/gi) { |
211
|
0
|
|
|
|
|
0
|
push @lines, { content => $parsed, |
212
|
|
|
|
|
|
|
depth => $depth }; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
else { |
216
|
124
|
|
|
|
|
539
|
$parsed =~ s/\[%(.+?)%\]/$param->{$1}/gi; |
217
|
124
|
|
|
|
|
532
|
push @lines, { content => $parsed, |
218
|
|
|
|
|
|
|
depth => $depth }; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
} |
222
|
90
|
|
|
|
|
438
|
return @lines; |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
1; |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=pod |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head1 SEE ALSO |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
WSDL::Generator |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head1 AUTHOR |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
"Pierre Denis" |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head1 COPYRIGHT |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Copyright (C) 2001, Fotango Ltd - All rights reserved. |
240
|
|
|
|
|
|
|
This is free software. This software may be modified and/or distributed under the same terms as Perl itself. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=cut |