line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Anansi::Script::SOAP; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Anansi::Script::SOAP - Defines the mechanisms specific to handling SOAP. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $OBJECT = Anansi::Script::SOAP->new(); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This module is designed to be an optional component module for use by the |
15
|
|
|
|
|
|
|
L component management module. It defines the processes |
16
|
|
|
|
|
|
|
specific to handling both input and output from Perl scripts that are executed |
17
|
|
|
|
|
|
|
by a web server using the Simple Object Access Protocol. See |
18
|
|
|
|
|
|
|
L for inherited methods. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
23895
|
use base qw(Anansi::Component); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1025
|
|
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
44474
|
use CGI; |
|
1
|
|
|
|
|
26196
|
|
|
1
|
|
|
|
|
11
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 finalise |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$OBJECT::SUPER->finalise(@_); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
An overridden virtual method called during object destruction. Not intended to |
40
|
|
|
|
|
|
|
be directly called unless overridden by a descendant. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub finalise { |
46
|
0
|
|
|
0
|
1
|
|
my ($self, %parameters) = @_; |
47
|
0
|
|
|
|
|
|
$self->used('CGI'); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 initialise |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$OBJECT::SUPER->initialise(@_); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
An overridden virtual method called during object creation. Not intended to be |
56
|
|
|
|
|
|
|
directly called unless overridden by a descendant. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub initialise { |
62
|
0
|
|
|
0
|
1
|
|
my ($self, %parameters) = @_; |
63
|
0
|
|
|
|
|
|
my $CGI = CGI->new(); |
64
|
0
|
|
|
|
|
|
$self->uses( |
65
|
|
|
|
|
|
|
CGI => $CGI, |
66
|
|
|
|
|
|
|
); |
67
|
0
|
|
|
|
|
|
$self->loadParameters(%parameters); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 loadParameters |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
$OBJECT->loadParameters(); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Loads all of the CGI parameters supplied upon page REQUEST. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub loadParameters { |
81
|
0
|
|
|
0
|
1
|
|
my ($self, %parameters) = @_; |
82
|
0
|
0
|
|
|
|
|
$self->{PARAMETERS} = {} if(!defined($self->{PARAMETERS})); |
83
|
0
|
|
|
|
|
|
foreach my $name ($self->{CGI}->param()) { |
84
|
0
|
|
|
|
|
|
${$self->{PARAMETERS}}{$name} = $self->{CGI}->param($name); |
|
0
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 medium |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my $medium = Anansi::Script::SOAP->medium(); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# OR |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
my $medium = $OBJECT->medium(); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# OR |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my $medium = $OBJECT->channel('MEDIUM'); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns the STRING description of the medium this module is designed to handle. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub medium { |
107
|
0
|
|
|
0
|
1
|
|
my $self = shift(@_); |
108
|
0
|
|
|
|
|
|
my $channel; |
109
|
0
|
0
|
|
|
|
|
$channel = shift(@_) if(0 < scalar(@_)); |
110
|
0
|
|
|
|
|
|
return 'SOAP'; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Script::SOAP', 'MEDIUM' => 'medium'); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 parameter |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my $parameters = $OBJECT->parameter(); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# OR |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my $parameters = $OBJECT->channel('PARAMETER'); |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# OR |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
my $parameterValue = $OBJECT->parameter(undef, 'parameter name'); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# OR |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
my $parameterValue = $OBJECT->channel('PARAMETER', 'parameter name'); |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# OR |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
if($OBJECT->parameter(undef, 'parameter name' => 'parameter value', 'another parameter' => undef)); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# OR |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
if($OBJECT->channel('PARAMETER', 'parameter name' => 'parameter value', 'another parameter' => undef)); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Either returns an ARRAY of all the existing parameter names or returns the value |
141
|
|
|
|
|
|
|
of a specific parameter or sets the value of one or more parameters. Assigning |
142
|
|
|
|
|
|
|
an "undef" value has the effect of deleting the parameter. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub parameter { |
148
|
0
|
|
|
0
|
1
|
|
my $self = shift(@_); |
149
|
0
|
|
|
|
|
|
my $channel; |
150
|
0
|
0
|
|
|
|
|
$channel = shift(@_) if(0 < scalar(@_)); |
151
|
0
|
0
|
|
|
|
|
if(0 == scalar(@_)) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
152
|
0
|
0
|
|
|
|
|
return [] if(!defined($self->{PARAMETERS})); |
153
|
0
|
|
|
|
|
|
return [( keys(%{$self->{PARAMETERS}}) )]; |
|
0
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
} elsif(1 == scalar(@_)) { |
155
|
0
|
|
|
|
|
|
my $name = shift(@_); |
156
|
0
|
0
|
|
|
|
|
return if(!defined($self->{PARAMETERS})); |
157
|
0
|
0
|
|
|
|
|
return if(!defined(${$self->{PARAMETERS}}{$name})); |
|
0
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
return ${$self->{PARAMETERS}}{$name}; |
|
0
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
} elsif(1 == scalar(@_) % 2) { |
160
|
0
|
|
|
|
|
|
return 0; |
161
|
|
|
|
|
|
|
} |
162
|
0
|
|
|
|
|
|
my ($name, %parameters) = @_; |
163
|
0
|
|
|
|
|
|
foreach my $name (keys(%parameters)) { |
164
|
0
|
0
|
|
|
|
|
if(defined(${$self->{PARAMETERS}}{$name})) { |
|
0
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
${$self->{PARAMETERS}}{$name} = $parameters{$name}; |
|
0
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
} else { |
167
|
0
|
|
|
|
|
|
delete(${$self->{PARAMETERS}}{$name}); |
|
0
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
} |
170
|
0
|
|
|
|
|
|
return 1; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Script::SOAP', 'PARAMETER' => 'parameter'); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 validate |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
my $valid = $OBJECT->validate(); |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
# OR |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
my $valid = $OBJECT->channel('VALIDATE_AS_APPROPRIATE'); |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Determines whether this module is the correct one to use for handling Perl |
185
|
|
|
|
|
|
|
script execution. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=cut |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub validate { |
191
|
0
|
|
|
0
|
1
|
|
my ($self, %parameters) = @_; |
192
|
0
|
|
|
|
|
|
my $channel; |
193
|
0
|
0
|
|
|
|
|
$channel = shift(@_) if(0 < scalar(@_)); |
194
|
0
|
0
|
|
|
|
|
return 0 if(!defined($ENV{'HTTP_HOST'})); |
195
|
0
|
|
|
|
|
|
my $CGI = CGI->new(); |
196
|
|
|
|
|
|
|
# Check the HTTP_SOAPACTION environment variable. |
197
|
0
|
0
|
|
|
|
|
return 0 if(!defined($CGI->http('SOAPAction'))); |
198
|
0
|
|
|
|
|
|
return 1; |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::Script::SOAP', 'VALIDATE_AS_APPROPRIATE' => 'validate'); |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head1 AUTHOR |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Kevin Treleaven |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
1; |