| 1 | # Copyrights 2007-2022 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.03. | ||||||||||||||||||||||||||||
| 5 | # This code is part of distribution XML-Compile-SOAP. 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::SOAP11::Server; | ||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 7 | $VERSION = '3.28'; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 7 | ▶ | use base 'XML::Compile::SOAP11', 'XML::Compile::SOAP::Server'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 7 | ▶ | use Log::Report 'xml-compile-soap'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 7 | ▶ | use XML::Compile::SOAP::Util qw/SOAP11ENV SOAP11NEXT/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 7 | ▶ | use XML::Compile::Util qw/pack_type unpack_type SCHEMA2001/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | sub init($) | ||||||||||||||||||||||||||||
| 25 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 26 | 0 | $self->XML::Compile::SOAP11::init($args); | |||||||||||||||||||||||||||
| 27 | 0 | $self->XML::Compile::SOAP::Server::init($args); | |||||||||||||||||||||||||||
| 28 | 0 | $self; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | sub makeError(@) | ||||||||||||||||||||||||||||
| 32 | 0 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
makeError: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 33 | 0 | info "Fault: $args{faultstring}"; | |||||||||||||||||||||||||||
| 34 | 0 | $self->faultWriter->(Fault => \%args); | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | sub faultValidationFailed($$) | ||||||||||||||||||||||||||||
| 38 | 0 | ▶ | { my ($self, $name, $exception) = @_; | ||||||||||||||||||||||||||
|
Subroutine
faultValidationFailed: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | my $message = | |||||||||||||||||||||||||||
| 41 | __x"operation {name} for {version} called with invalid data" | ||||||||||||||||||||||||||||
| 42 | , name => $name, version => 'SOAP11'; | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | my $errors = XML::LibXML::Element->new('error'); | |||||||||||||||||||||||||||
| 45 | 0 | $errors->appendText($exception->message->toString); | |||||||||||||||||||||||||||
| 46 | 0 | my $detail = XML::LibXML::Element->new('detail'); | |||||||||||||||||||||||||||
| 47 | 0 | $detail->addChild($errors); | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | $self->makeError | |||||||||||||||||||||||||||
| 50 | ( faultcode => pack_type(SOAP11ENV, 'Server.validationFailed') | ||||||||||||||||||||||||||||
| 51 | , faultstring => $message | ||||||||||||||||||||||||||||
| 52 | , faultactor => $self->role | ||||||||||||||||||||||||||||
| 53 | , detail => $detail | ||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | sub faultResponseInvalid($$) | ||||||||||||||||||||||||||||
| 58 | 0 | ▶ | { my ($self, $name, $exception) = @_; | ||||||||||||||||||||||||||
|
Subroutine
faultResponseInvalid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | my $message = | |||||||||||||||||||||||||||
| 61 | __x"procedure {name} for {version} produced an invalid response" | ||||||||||||||||||||||||||||
| 62 | , name => $name, version => 'SOAP11'; | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | my $errors = XML::LibXML::Element->new('error'); | |||||||||||||||||||||||||||
| 65 | 0 | $errors->appendText($exception->message->toString); | |||||||||||||||||||||||||||
| 66 | 0 | my $detail = XML::LibXML::Element->new('detail'); | |||||||||||||||||||||||||||
| 67 | 0 | $detail->addChild($errors); | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | # fault code does not really exist, but we need it. | ||||||||||||||||||||||||||||
| 70 | 0 | $self->makeError | |||||||||||||||||||||||||||
| 71 | ( faultcode => pack_type(SOAP11ENV, 'Server.invalidResponse') | ||||||||||||||||||||||||||||
| 72 | , faultstring => $message | ||||||||||||||||||||||||||||
| 73 | , faultactor => $self->role | ||||||||||||||||||||||||||||
| 74 | , detail => $detail | ||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | sub faultNotImplemented($) | ||||||||||||||||||||||||||||
| 79 | 0 | ▶ | { my ($self, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
faultNotImplemented: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | my $message = __x"procedure {name} for {version} is not yet implemented" | |||||||||||||||||||||||||||
| 82 | , name => $name, version => 'SOAP11'; | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | +{ Fault => | |||||||||||||||||||||||||||
| 85 | { faultcode => pack_type(SOAP11ENV, 'Server.notImplemented') | ||||||||||||||||||||||||||||
| 86 | , faultstring => $message | ||||||||||||||||||||||||||||
| 87 | , faultactor => SOAP11NEXT | ||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | }; | ||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | sub faultNoAnswerProduced($) | ||||||||||||||||||||||||||||
| 93 | 0 | ▶ | { my ($self, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
faultNoAnswerProduced: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 0 | my $message = __x"callback {name} did not return an answer", name => $name; | |||||||||||||||||||||||||||
| 96 | 0 | $self->makeError | |||||||||||||||||||||||||||
| 97 | ( faultcode => pack_type(SOAP11ENV, 'Server.noAnswerProduced') | ||||||||||||||||||||||||||||
| 98 | , faultstring => $message | ||||||||||||||||||||||||||||
| 99 | , faultactor => $self->role | ||||||||||||||||||||||||||||
| 100 | ); | ||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | sub faultMessageNotRecognized($$$) | ||||||||||||||||||||||||||||
| 104 | 0 | ▶ | { my ($self, $name, $action, $handlers) = @_; | ||||||||||||||||||||||||||
|
Subroutine
faultMessageNotRecognized: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | my $message; | |||||||||||||||||||||||||||
| 107 | 0 | ▶ | if($handlers && @$handlers) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$handlers and @$handlers
MC/DC0%0/2
$handlers and @$handlers
$handlers
@$handlers
Truth table0%0/3
A and B
A= $handlersB= @$handlers
| |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | { my $sa = $action ? " (soapAction $action)" : ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 109 | 0 | $message = __x"{version} body element {name}{sa} not recognized, available ports are {def}" | |||||||||||||||||||||||||||
| 110 | , version => 'SOAP11', name => $name, sa => $sa, def => $handlers; | ||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | else | ||||||||||||||||||||||||||||
| 113 | 0 | { $message = | |||||||||||||||||||||||||||
| 114 | __x"{version} there are no handlers available, so also not for {name}" | ||||||||||||||||||||||||||||
| 115 | , version => 'SOAP11', name => $name; | ||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | $self->makeError | |||||||||||||||||||||||||||
| 119 | ( faultcode => pack_type(SOAP11ENV, 'Server.notRecognized') | ||||||||||||||||||||||||||||
| 120 | , faultstring => $message | ||||||||||||||||||||||||||||
| 121 | , faultactor => SOAP11NEXT | ||||||||||||||||||||||||||||
| 122 | ); | ||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | sub faultTryOtherProtocol($$) | ||||||||||||||||||||||||||||
| 126 | 0 | ▶ | { my ($self, $name, $other) = @_; | ||||||||||||||||||||||||||
|
Subroutine
faultTryOtherProtocol: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | my $message = | |||||||||||||||||||||||||||
| 129 | __x"body element {name} not available in {version}, try {other}" | ||||||||||||||||||||||||||||
| 130 | , name => $name, version => 'SOAP11', other => $other; | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 0 | $self->makeError | |||||||||||||||||||||||||||
| 133 | ( faultcode => pack_type(SOAP11ENV, 'Server.tryUpgrade') | ||||||||||||||||||||||||||||
| 134 | , faultstring => $message | ||||||||||||||||||||||||||||
| 135 | , faultactor => SOAP11NEXT | ||||||||||||||||||||||||||||
| 136 | ); | ||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 7 | 1; | |||||||||||||||||||||||||||