| 1 | package CAM::SOAPClient; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | require 5.005_62; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use SOAP::Lite; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | our $VERSION = '1.17'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | =for stopwords Lapworth subclassable wsdl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | CAM::SOAPClient - SOAP interaction tools | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | Copyright 2006 Clotho Advanced Media, Inc., <cpan@clotho.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | This library is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | use CAM::SOAPClient; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | my $client = CAM::SOAPClient->new(wsdl => 'http://www.clotho.com/staff.wsdl'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | my ($fname, $lname) = $client->call('fetchEmployee', '[firstName,lastName]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | ssn => '000-00-0000'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | my $record = $client->call('fetchEmployee', undef, ssn => '000-00-0000'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | my @addresses = $client->call('allEmployees', '@email'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | my $firstbudget = $client->call('listClientProjects', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | '/client/projects/project/budget'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | if ($client->hadFault()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | die 'SOAP Fault: ' . $client->getLastFaultString(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | This module offers some basic tools to simplify the creation of SOAP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | client implementations. It is intended to be subclassable, but works | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | fine as-is too. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | The purpose for this module is to abstract the complexity of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | SOAP::Lite. That module makes easy things really easy and hard things | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | possible, but quite obscure. The problem is that the easy things are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | often too basic. For example, calling remote methods with positional | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | arguments is easy, but with named arguments is much harder. Calling | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | methods on a SOAP::Lite server is easy, but an Apache Axis server is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | much harder. This module attempts to make typical SOAP and WSDL activities | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | easier by hiding some of the weirdness of SOAP::Lite. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | The main method is call(), via which you can specify what remote | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | method to invoke, what return values you want, and the named arguments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | you want to pass. See below for more detail. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | This package has been tested against servers running SOAP::Lite, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | Apache Axis, and PEAR SOAP. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | L<SOAP::Lite::Simple> is another module with very similar goals to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | this one. Leo Lapworth, the author of that module, and I have briefly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | discussed merging the work into a single package, but have not made | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | much progress. If any users are interested in such a merger, let us know. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | =item $pkg->new([opts], $uri) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | =item $pkg->new([opts], $uri, $proxy) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | =item $pkg->new([opts], $uri, $proxy, $username, $password) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | =item $pkg->new([opts], wsdl => $url) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | =item $pkg->new([opts], wsdl => $url, $username, $password) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | Create a connection instance. The C<$proxy> is not required here, but | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | if not specified it must be set later via C<setProxy()>. Optionally | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | (and recommended) you can specify a WSDL C<$url> instead of a C<$uri> and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | C<$proxy>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | If a C<$username> is specified, then the C<$username> and C<$password> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | are simply passed to C<setUserPass()>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | The options are as follows: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | =item timeout => $seconds | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | This defaults to 6 hours. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 5 | my $pkg = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 5 | my %cfg = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | timeout => 6*60*60, # 6 hours | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 5 | ▶ | while (@_ > 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 4 | ▶ | if ($_[0] eq 'timeout') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my $val = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $cfg{$key} = $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 4 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 5 | my $uri = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 5 | my $proxy = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 5 | my $user = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 5 | my $pass = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 5 | ▶ | return if (!$uri); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 4 | ▶ | my $soap = SOAP::Lite -> on_fault( sub {} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 4 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | %cfg, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | services => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | soap => $soap, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | auth => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | global_proxy => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | global_uri => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | proxies => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | uris => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | }, $pkg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 4 | ▶ | if ($uri eq 'wsdl') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | $self->setWSDL($proxy); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 3 | $self->setURI($uri); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 3 | ▶ | if ($proxy) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 1 | $self->setProxy($proxy); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 4 | ▶ | if ($user) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 1 | $self->setUserPass($user, $pass); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 4 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | =item $self->setWSDL($url) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | Loads a Web Service Description Language file describing the SOAP service. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | sub setWSDL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setWSDL: called CC=6 SCAR=18.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 1 | my $url = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # The SOAP::Schema API changed as of SOAP::Lite v0.65-beta2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | ▶ | my $schema = SOAP::Schema->can('schema_url') ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | SOAP::Schema->schema_url($url) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | SOAP::Schema->schema($url); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | my $services = $schema->parse()->services(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | #use Data::Dumper; print STDERR Dumper($services); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | foreach my $class (values %{$services}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | foreach my $method (keys %{$class}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | my $endpoint = $class->{$method}->{endpoint}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # 'uri' was used thru SOAP::Lite v0.60, 'namespace' is used in v0.65+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | ▶ | my $namespace = $class->{$method}->{uri} ? $class->{$method}->{uri}->value() : $class->{$method}->{namespace}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | ▶ | $self->{proxies}->{$method} = $endpoint ? $endpoint->value() : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | $self->{uris}->{$method} = $namespace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | =item $self->setURI($uri) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | Specifies the URI for the SOAP server. This is not needed if you are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | using WSDL. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | sub setURI | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setURI: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 3 | my $uri = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 3 | $self->{global_uri} = $uri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 3 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | =item $self->setProxy($proxy) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | Specifies the URL for the SOAP server. This is not needed if you are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | using WSDL. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | sub setProxy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setProxy: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | my $proxy = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 1 | $self->{global_proxy} = $proxy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | =item $self->setUserPass($username, $password) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | Specifies the C<$username> and C<$password> to use on the SOAP server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | These values are stored until used via loginParams(). Most | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | applications won't use this method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | sub setUserPass | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setUserPass: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 1 | my $username = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 1 | my $password = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 1 | $self->{auth}->{username} = $username; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 1 | $self->{auth}->{password} = $password; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | =item $self->getLastSOM() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | Returns the SOAP::SOM object for the last query. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | sub getLastSOM | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLastSOM: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | return $self->{last_som}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | =item $self->hadFault() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | Returns a boolean indicating whether the last call() resulted in a fault. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | sub hadFault | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hadFault: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | my $som = $self->getLastSOM(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | return $som && (ref $som) && $som->fault(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$som && ref $som && $som->fault
$som and ref $som
MC/DC0%0/3
$som && ref $som && $som->fault
$som
ref $som
$som->fault
Truth table0%0/4
A and B && C
A= $somB= ref $somC= $som->fault
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | =item $self->getLastFaultCode() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | Returns the fault code from the last query, or C<(none)> if the last | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | query did not result in a fault. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | sub getLastFaultCode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLastFaultCode: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my $som = $self->getLastSOM(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if ($som && (ref $som) && $som->can('faultcode') && $som->fault()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$som and ref $som and $som->can("faultcode") and $som->fault
$som and ref $som and $som->can("faultcode")
$som and ref $som
MC/DC0%0/4
$som and ref $som and $som->can("faultcode") and $som->fault
$som
ref $som
$som->can("faultcode")
$som->fault
Truth table0%0/5
A and B and C and D
A= $somB= ref $somC= $som->can("faultcode")D= $som->fault
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | return $som->faultcode(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | return '(none)'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | =item $self->getLastFaultString() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | Returns the fault string from the last query, or C<(none)> if the last | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | query did not result in a fault. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | sub getLastFaultString | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLastFaultString: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | my $som = $self->getLastSOM(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | if ($som && (ref $som) && $som->can('faultstring') && $som->fault()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$som and ref $som and $som->can("faultstring") and $som->fault
$som and ref $som and $som->can("faultstring")
$som and ref $som
MC/DC0%0/4
$som and ref $som and $som->can("faultstring") and $som->fault
$som
ref $som
$som->can("faultstring")
$som->fault
Truth table0%0/5
A and B and C and D
A= $somB= ref $somC= $som->can("faultstring")D= $som->fault
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | return $som->faultstring(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | return '(none)'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | =item $self->getLastFault() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | Creates a new SOAP::Fault instance from the last fault data, if any. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | there was no fault (as per the hadFault() method) then this returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | undef. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | sub getLastFault | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLastFault: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | return if (!$self->hadFault()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $som = $self->getLastSOM(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | return if (!$som || !(ref $som) || !$som->fault()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$som and ref $som and $som->fault
$som and ref $som
MC/DC0%0/3
$som and ref $som and $som->fault
$som
ref $som
$som->fault
Truth table0%0/4
A and B and C
A= $somB= ref $somC= $som->fault
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | my $code = $som->can('faultcode') ? $som->faultcode() : 'Unknown'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | my $string = $som->can('faultstring') ? $som->faultstring() : 'An unknown error has occurred'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | my $detail = $som->can('faultdetail') ? $som->faultdetail() : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | if ($detail) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | $detail = $detail->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | my $fault = SOAP::Fault->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | faultcode => $code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | faultstring => $string, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | ($detail ? (faultdetail => SOAP::Data->name('data' => $detail)) : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | return $fault; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | =item $self->call($method, undef, $key1 => $value1, $key2 => $value, ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | =item $self->call($method, $xpath, $key1 => $value1, $key2 => $value, ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | =item $self->call($method, $xpath_arrayref, $key1 => $value1, $key2 => $value, ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | Invoke the named SOAP method. The return values are indicated in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | second argument, which can be undef, a single scalar or a list of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | return fields. If this path is undef, then all data are returned as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | if the SOAP C<paramsout()> method was called. Otherwise, the SOAP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | response is searched for these values. If any of them are missing, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | call() returns undef. If multiple values are specified, they are all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | returned in array context, while just the first one is returned in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | scalar context. This is best explained by examples: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 'documentID' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | /Envelope/Body/<method>/documentID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | ['documentID', 'data/[2]/type', '//result'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | (/Envelope/Body/<method>/documentID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | /Envelope/Body/<method>/data/[2]/type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | /Envelope/Body/<method>/*/result) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | /Envelope/Body/<method>/documentID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | in scalar context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | If the path matches multiple fields, just the first is returned. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | Alternatively, if the path is prefixed by a C<@> character, it is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | expected that the path will match multiple fields. If there is just | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | one path, the matches are returned as an array (just the first one in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | scalar context). If there are multiple paths specified, then the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | matches are returned as an array reference. For example, imagine a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | query that returns a list of documents with IDs 4,6,7,10,20 for user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | #12. Here we detail the return values for the following paths: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | path: 'documents/item/id' or ['documents/item/id'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | array context: (4) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | scalar context: 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | path: '@documents/item/id' or ['@documents/item/id'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | array context: (4,6,7,10,20) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | scalar context: 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | path: ['documents/item/id', 'userID'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | array context: (4, 12) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | scalar context: 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | path: ['@documents/item/id', 'userID'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | array context: ([4,6,7,10,20], 12) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | scalar context: [4,6,7,10,20] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | path: ['userID', '@documents/item/id'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | array context: (12, [4,6,7,10,20]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | scalar context: 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | sub call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call: called CC=18 SCAR=31.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 16 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 16 | my $method = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 16 | my $paths = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 16 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 16 | my @rets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 16 | ▶ | if ($paths && !ref $paths) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$paths and not ref $paths
MC/DC100%2/2
$paths and not ref $paths
$paths
not ref $paths
Truth table100%3/3
A and not(B)
A= $pathsB= not ref $paths
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 4 | $paths = [$paths]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 16 | ▶ | my $uri = $self->{uris}->{$method} || $self->{global_uri}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'uris'}{$method} || $self->{'global_uri'}
MC/DC0%0/2
$self->{'uris'}{$method} || $self->{'global_uri'}
$self->{'uris'}{$method}
$self->{'global_uri'}
Truth table33%1/3
A || B
A= $self->{'uris'}{$method}B= $self->{'global_uri'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 16 | ▶ | my $proxy = $self->{proxies}->{$method} || $self->{global_proxy}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'proxies'}{$method} || $self->{'global_proxy'}
MC/DC0%0/2
$self->{'proxies'}{$method} || $self->{'global_proxy'}
$self->{'proxies'}{$method}
$self->{'global_proxy'}
Truth table33%1/3
A || B
A= $self->{'proxies'}{$method}B= $self->{'global_proxy'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 16 | ▶ | if (!$uri || !$proxy) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$uri and $proxy
MC/DC0%0/2
$uri and $proxy
$uri
$proxy
Truth table33%1/3
A and B
A= $uriB= $proxy
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # Create a minimal SOAP fault from scratch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $self->_setFault('Client', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | "Attempted to call method '$method' which lacks a URI or proxy. Are you sure you called the right method?"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 16 | ▶ | my $soap = SOAP::Lite->can('ns') ? $self->{soap}->ns($uri) : $self->{soap}->uri($uri); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | my $som = $soap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | ->proxy($proxy, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | ($self->{timeout} ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 16 | ▶ | (timeout => $self->{timeout}) : ()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | ->call($method, $self->request($self->loginParams(), @args)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 16 | ▶ | if (!$som || !ref $som) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$som and ref $som
MC/DC0%0/2
$som and ref $som
$som
ref $som
Truth table33%1/3
A and B
A= $somB= ref $som
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | $self->_setFault('Client', 'Communication failure'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 16 | $self->{last_som} = $som; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 16 | ▶ | if ($som->fault) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 16 | ▶ | if (!defined $paths) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 2 | @rets = ($som->match('/Envelope/Body/[1]')->valueof()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 14 | foreach my $origpath (@{$paths}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 20 | my $path = $origpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 20 | my $is_array = ($path =~ s/\A\@//xms); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 20 | ▶ | return if (!$som->match("/Envelope/Body/[1]/$path")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 20 | my @values = $som->valueof(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 20 | ▶ | if ($is_array) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 8 | ▶ | if (@{$paths} == 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 4 | push @rets, @values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 4 | push @rets, [@values]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 12 | push @rets, $values[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 16 | ▶ | return wantarray ? @rets : $rets[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | sub _setFault | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_setFault: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my $code = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $self->{last_som} = SOAP::Deserializer->deserialize(<<"EOF" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | <Body> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | <Fault> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | <faultcode>$code</faultcode> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | <faultstring>$string</faultstring> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | </Fault> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | </Body> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | </Envelope> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | =item $self->loginParams() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | This is intended to return a hash of all the required parameters shared | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | by all SOAP requests. This version returns the contents of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | C<%{$soap->{auth}}>. Some subclasses may wish to override this, while | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | others may wish to simply add more to that hash. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | sub loginParams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
loginParams: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 17 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 17 | return (%{$self->{auth}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | =item $self->request($key1 => $value1, $key2 => $value2, ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | =item $self->request($soapdata1, $soapdata2, ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | Helper routine which wraps its key-value pair arguments in SOAP::Data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | objects, if they are not already in that form. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | sub request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request: called CC=5 SCAR=26.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 16 | my $pkg_or_self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # other args below | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 16 | my @return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 16 | ▶ | while (@_ > 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | my $var = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | if ($var && (ref $var) && (ref $var) eq 'SOAP::Data') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$var and ref $var and ref $var eq "SOAP::Data"
$var and ref $var
MC/DC0%0/3
$var and ref $var and ref $var eq "SOAP::Data"
$var
ref $var
ref $var eq "SOAP::Data"
Truth table0%0/4
A and B and C
A= $varB= ref $varC= ref $var eq "SOAP::Data"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | push @return, $var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | push @return, SOAP::Data->name($var, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 16 | return @return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||