SOAP12/Server.pm

filter: Statementstmt 38.2% 26 / 68 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 13 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 50.0% 8 / 16 Podpod 0.0% 0 / 8 totaltotal 29.0% 34 / 117 CC 8 SCAR 23.9
CC
8
Cov
31%
makeError
30.0
faultMessageNotRecognized
20.0
init
2.0
CRAP 10.9
« SOAP12.pm ↑ Summary SOAP12/Client.pm »
1 # Copyrights 2009-2018 by [Mark Overmeer <markov@cpan.org>].
2 # For other contributors see ChangeLog.
3 # See the manual pages for details on the licensing terms.
4 # Pod stripped from pm file by OODoc 2.02.
5 # This code is part of distribution XML-Compile-SOAP12. Meta-POD processed
6 # with OODoc into POD and HTML manual-pages. See README.md
7 # Copyright Mark Overmeer. Licensed under the same terms as Perl itself.
8  
9 package XML::Compile::SOAP12::Server;
10 1 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 $VERSION = '3.06';
12  
13 1 ▶use base 'XML::Compile::SOAP12', 'XML::Compile::SOAP::Server';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use Log::Report 'xml-compile-soap';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use XML::Compile::Util qw/pack_type unpack_type SCHEMA2001/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use XML::Compile::SOAP::Util qw/XC_DAEMON_NS/;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use XML::Compile::SOAP12::Util qw/SOAP12ENV SOAP12NEXT/;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24  
25 sub init($)
26 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=1 SCAR=6.9
Pod undocumented
27 0 $self->XML::Compile::SOAP12::init($args);
28 0 $self->XML::Compile::SOAP::Server::init($args);
29 0 $self;
30 }
31  
32 sub makeError(@)
33 0 ▶{ my ($self, %args) = @_;
Subroutine makeError: not called CC=5 SCAR=34.0
Pod undocumented
34  
35 0 my %error;
36 0 ▶ $error{Role} = $args{Role} || $args{faultactor};
Condition0%0/3
$args{'Role'} || $args{'faultactor'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'Role'} || $args{'faultactor'}
$args{'Role'} $args{'faultactor'}
Truth table0%0/3
A || B
A= $args{'Role'}B= $args{'faultactor'}
ABresult
1X1
011
000
37 0 ▶ $error{Detail} = $args{Detail} || $args{detail};
Condition0%0/3
$args{'Detail'} || $args{'detail'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'Detail'} || $args{'detail'}
$args{'Detail'} $args{'detail'}
Truth table0%0/3
A || B
A= $args{'Detail'}B= $args{'detail'}
ABresult
1X1
011
000
38  
39 $error{Code} = $args{Code}
40 || { Value => pack_type(SOAP12ENV, 'Receiver')
41 , Subcode => { Value => $args{faultcode} }
42 0 ▶ };
Condition0%0/2
$args{'Code'} || {'Value', &pack_type('http://www.w3.org/2003/05/soap-envelope', 'Receiver'), 'Subcode', {'Value', $args{'faultcode'}}}
l!l
00
MC/DC0%0/1
$args{'Code'} || {'Value', &pack_type('http://www.w3.org/2003/05/soap-envelope', 'Receiver'), 'Subcode', {'Value', $args{'faultcode'}}}
$args{'Code'}
Truth table0%0/2
A
A= $args{'Code'}
Aresult
11
00
43  
44 $error{Reason} = $args{Reason}
45 0 ▶ || { Text => [ { lang => 'en', _ => $args{faultstring} } ] };
Condition0%0/2
$args{'Reason'} || {'Text', [{'lang', 'en', '_', $args{'faultstring'}}]}
l!l
00
MC/DC0%0/1
$args{'Reason'} || {'Text', [{'lang', 'en', '_', $args{'faultstring'}}]}
$args{'Reason'}
Truth table0%0/2
A
A= $args{'Reason'}
Aresult
11
00
46  
47 0 info "Fault: $error{Reason}{Text}[0]{_}";
48 0 $self->faultWriter->(Fault => \%error);
49 }
50  
51 sub faultValidationFailed($$)
52 0 ▶{ my ($self, $name, $exception) = @_;
Subroutine faultValidationFailed: not called CC=1 SCAR=6.9
Pod undocumented
53  
54 0 my $message =
55 __x"operation {name} for {version} called with invalid data"
56 , name => $name, version => 'SOAP12';
57  
58 0 my $errors = XML::LibXML::Element->new('error');
59 0 $errors->appendText($exception->message->toString);
60 0 my $detail = XML::LibXML::Element->new('detail');
61 0 $detail->addChild($errors);
62  
63 0 $self->makeError
64 ( faultcode => pack_type(XC_DAEMON_NS, 'validationFailed')
65 , faultstring => $message
66 , faultactor => $self->role
67 , detail => $detail
68 );
69 }
70  
71 sub faultResponseInvalid($$)
72 0 ▶{ my ($self, $name, $exception) = @_;
Subroutine faultResponseInvalid: not called CC=1 SCAR=6.9
Pod undocumented
73  
74 0 my $message =
75 __x"procedure {name} for {version} produced an invalid response"
76 , name => $name, version => 'SOAP12';
77  
78 # Namespace qualified?
79 0 my $errors = XML::LibXML::Element->new('error');
80 0 $errors->appendText($exception->message->toString);
81 0 my $detail = XML::LibXML::Element->new('Detail');
82 0 $detail->addChild($errors);
83  
84 0 $self->makeError
85 ( faultcode => pack_type(XC_DAEMON_NS, 'invalidResponse')
86 , faultstring => $message
87 , faultactor => $self->role
88 , detail => $detail
89 );
90 }
91  
92 sub faultNotImplemented($)
93 0 ▶{ my ($self, $name) = @_;
Subroutine faultNotImplemented: not called CC=1 SCAR=6.9
Pod undocumented
94  
95 0 my $message = __x"procedure {name} for {version} is not yet implemented"
96 , name => $name, version => 'SOAP12';
97  
98 0 $self->makeError
99 ( faultcode => pack_type(XC_DAEMON_NS, 'notImplemented')
100 , faultstring => $message
101 , faultactor => SOAP12NEXT
102 );
103 }
104  
105 sub faultNoAnswerProduced($)
106 0 ▶{ my ($self, $name) = @_;
Subroutine faultNoAnswerProduced: not called CC=1 SCAR=6.9
Pod undocumented
107
108 0 my $message = __x"callback {name} did not return an answer", name => $name;
109 0 $self->makeError
110 ( faultcode => pack_type(XC_DAEMON_NS, 'noAnswerProduced')
111 , faultstring => $message
112 , faultactor => $self->role
113 );
114 }
115  
116 sub faultMessageNotRecognized($$$)
117 0 ▶{ my ($self, $name, $action, $handlers) = @_;
Subroutine faultMessageNotRecognized: not called CC=4 SCAR=30.0
Pod undocumented
118  
119 0 my $message;
120 0 ▶ if($handlers && @$handlers)
Branch: 1 branch
BranchTrueFalseTotal
if ($handlers and @$handlers) { } 0 0 0
Condition0%0/3
$handlers and @$handlers
!ll&&!rl&&r
000
MC/DC0%0/2
$handlers and @$handlers
$handlers @$handlers
Truth table0%0/3
A and B
A= $handlersB= @$handlers
ABresult
0X0
100
111
121 0 ▶ { my $sa = $action ? " (soapAction $action)" : '';
Branch: 1 branch
BranchTrueFalseTotal
$action ? : 0 0 0
122 0 $message = __x"{version} body element {name}{sa} not recognized, available ports are {def}"
123 , version => 'SOAP12', name => $name, sa => $sa, def => $handlers;
124 }
125 else
126 0 { $message =
127 __x"{version} there are no handlers available, so also not for {name}"
128 , version => 'SOAP12', name => $name;
129 }
130  
131 0 $self->makeError
132 ( faultcode => pack_type(XC_DAEMON_NS, 'notRecognized')
133 , faultstring => $message
134 , faultactor => SOAP12NEXT
135 );
136 }
137  
138 sub faultTryOtherProtocol($$)
139 0 ▶{ my ($self, $name, $other) = @_;
Subroutine faultTryOtherProtocol: not called CC=1 SCAR=6.9
Pod undocumented
140  
141 0 my $message =
142 __x"body element {name} not available in {version}, try {other}"
143 , name => $name, version => 'SOAP12', other => $other;
144  
145 0 $self->makeError
146 ( faultcode => pack_type(XC_DAEMON_NS, 'tryUpgrade')
147 , faultstring => $message
148 , faultactor => SOAP12NEXT
149 );
150 }
151  
152 1 1;
« SOAP12.pm ↑ Summary SOAP12/Client.pm »