| 1 | # Copyrights 2007-2021 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-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::SOAP; | ||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 7 | $VERSION = '3.27'; | |||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | 7 | ▶ | use Log::Report 'xml-compile-soap'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||
| 19 | 7 | ▶ | use XML::Compile (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 20 | 7 | use XML::Compile::Util qw(SCHEMA2001 SCHEMA2001i pack_type | |||||||||||||||||||||||||||||||
| 21 | 7 | ▶ | unpack_type type_of_node); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 22 | 7 | ▶ | use XML::Compile::Cache (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 23 | 7 | ▶ | use XML::Compile::SOAP::Util qw/:xop10 SOAP11ENC/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 25 | 7 | ▶ | use Time::HiRes qw/time/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 26 | 7 | ▶ | use MIME::Base64 qw/decode_base64/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | # XML::Compile::WSA::Util often not installed | ||||||||||||||||||||||||||||||||
| 29 | 7 | ▶ | use constant WSA10 => 'http://www.w3.org/2005/08/addressing'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 11 | ▶ | sub _xop_enabled() { exists $INC{'XML/Compile/XOP.pm'} } | ||||||||||||||||||||||||||||||
|
Subroutine
_xop_enabled: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | sub new($@) | ||||||||||||||||||||||||||||||||
| 35 | 6 | ▶ | { my $class = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||
| 37 | 6 | ▶ | error __x"you can only instantiate sub-classes of {class}", class => $class | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 38 | if $class eq __PACKAGE__; | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | 6 | (bless {}, $class)->init( {@_} ); | |||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | sub init($) | ||||||||||||||||||||||||||||||||
| 44 | 6 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 45 | 6 | ▶ | $self->{XCS_mime} = $args->{media_type} || 'application/soap+xml'; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'media_type'} || 'application/soap+xml'
MC/DC0%0/1
$args->{'media_type'} || 'application/soap+xml'
$args->{'media_type'}
Truth table50%1/2
A
A= $args->{'media_type'}
| |||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | my $schemas = $self->{XCS_schemas} = $args->{schemas} | ||||||||||||||||||||||||||||||||
| 48 | 6 | ▶ | || XML::Compile::Cache->new(allow_undeclared => 1 | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$args->{'schemas'} || 'XML::Compile::Cache'->new('allow_undeclared', 1, 'any_element', 'ATTEMPT', 'any_attribute', 'ATTEMPT')
MC/DC0%0/2
$args->{'schemas'} || 'XML::Compile::Cache'->new('allow_undeclared', 1, 'any_element', 'ATTEMPT', 'any_attribute', 'ATTEMPT')
$args->{'schemas'}
'XML::Compile::Cache'->new('allow_undeclared', 1, 'any_element', 'ATTEMPT', 'any_attribute', 'ATTEMPT')
Truth table33%1/3
A || B
A= $args->{'schemas'}B= 'XML::Compile::Cache'->new('allow_undeclared', 1, 'any_element', 'ATTEMPT', 'any_attribute', 'ATTEMPT')
| |||||||||||||||||||||||||||||||||
| 49 | , any_element => 'ATTEMPT', any_attribute => 'ATTEMPT'); | ||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | 6 | ▶ | UNIVERSAL::isa($schemas, 'XML::Compile::Cache') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 52 | or panic "schemas must be a Cache object"; | ||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||
| 54 | 6 | $self; | |||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||
| 57 | sub _initSOAP($) | ||||||||||||||||||||||||||||||||
| 58 | 6 | ▶ | { my ($thing, $schemas) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_initSOAP: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||
| 59 | return $thing | ||||||||||||||||||||||||||||||||
| 60 | 6 | ▶ | if $schemas->{did_init_SOAP}++; # ugly | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||
| 62 | 6 | $schemas->addPrefixes(xsd => SCHEMA2001, xsi => SCHEMA2001i); | |||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||
| 64 | 6 | $thing; | |||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | 7 | { my (%registered, %envelope); | |||||||||||||||||||||||||||||||
| 69 | sub register($) | ||||||||||||||||||||||||||||||||
| 70 | 7 | ▶ | { my ($class, $uri, $env, $opclass) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
register: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 71 | 7 | $registered{$uri} = $class; | |||||||||||||||||||||||||||||||
| 72 | 7 | ▶ | $envelope{$env} = $opclass if $env; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub plugin($) { $registered{$_[1]} } | ||||||||||||||||||||||||||||||
|
Subroutine
plugin: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | sub fromEnvelope($) { $envelope{$_[1]} } | ||||||||||||||||||||||||||||||
|
Subroutine
fromEnvelope: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub registered($) { values %registered } | ||||||||||||||||||||||||||||||
|
Subroutine
registered: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||
| 79 | #-------------------- | ||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub version() {panic "not implemented"} | ||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub mediaType() {shift->{XCS_mime}} | ||||||||||||||||||||||||||||||
|
Subroutine
mediaType: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | sub schemas() { | ||||||||||||||||||||||||||||||||
| 86 | 7 | ▶ | use Carp 'cluck'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 87 | 193 | ▶ | ref $_[0] or cluck; | ||||||||||||||||||||||||||||||
|
Subroutine
schemas: called CC=2 SCAR=7.2
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 88 | 193 | shift->{XCS_schemas}} | |||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||
| 90 | #-------------------- | ||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||
| 92 | sub compileMessage($@) | ||||||||||||||||||||||||||||||||
| 93 | 11 | ▶ | { my ($self, $direction, %args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
compileMessage: called CC=4 SCAR=14.3
Pod
documented
| |||||||||||||||||||||||||||||||||
| 94 | 11 | ▶ | $args{style} ||= 'document'; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"style"} ||= "document"
MC/DC0%0/1
$args{"style"} ||= "document"
$args{"style"}
Truth table50%1/2
A
A= $args{"style"}
| |||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||
| 96 | 11 | ▶ | $direction eq 'SENDER' ? $self->_sender(%args) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 97 | : $direction eq 'RECEIVER' ? $self->_receiver(%args) | ||||||||||||||||||||||||||||||||
| 98 | : error __x"message direction is 'SENDER' or 'RECEIVER', not `{dir}'" | ||||||||||||||||||||||||||||||||
| 99 | , dir => $direction; | ||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||
| 103 | sub messageStructure($) | ||||||||||||||||||||||||||||||||
| 104 | 1 | ▶ | { my ($thing, $xml) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
messageStructure: called CC=8 SCAR=23.2
Pod
documented
| |||||||||||||||||||||||||||||||||
| 105 | 1 | ▶ | my $env = $xml->isa('XML::LibXML::Document') ? $xml->documentElement :$xml; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||
| 107 | 1 | my (@header, @body, $wsa_action); | |||||||||||||||||||||||||||||||
| 108 | 1 | ▶ | if(my ($header) = $env->getChildrenByLocalName('Header')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 109 | 1 | ▶ | { @header = map { $_->isa('XML::LibXML::Element') ? type_of_node($_) : ()} | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 110 | $header->childNodes; | ||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||
| 112 | 1 | ▶ | if(my $wsa = ($header->getChildrenByTagNameNS(WSA10, 'Action'))[0]) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 113 | 0 | { $wsa_action = $wsa->textContent; | |||||||||||||||||||||||||||||||
| 114 | 0 | for($wsa_action) { s/^\s+//; s/\s+$//; s/\s{2,}/ /g } | |||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||
| 118 | 1 | ▶ | if(my ($body) = $env->getChildrenByLocalName('Body')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 119 | 1 | ▶ | { @body = map { $_->isa('XML::LibXML::Element') ? type_of_node($_) : () } | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 120 | $body->childNodes; | ||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||
| 123 | 1 | +{ header => \@header | |||||||||||||||||||||||||||||||
| 124 | , body => \@body | ||||||||||||||||||||||||||||||||
| 125 | , wsa_action => $wsa_action | ||||||||||||||||||||||||||||||||
| 126 | }; | ||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||
| 129 | #------------------------------------------------ | ||||||||||||||||||||||||||||||||
| 130 | # Sender | ||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||
| 132 | sub _sender(@) | ||||||||||||||||||||||||||||||||
| 133 | 5 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_sender: called CC=14 SCAR=33.2
| |||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||
| 135 | 5 | ▶ | error __"option 'role' only for readers" if $args{role}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 136 | 5 | ▶ | error __"option 'roles' only for readers" if $args{roles}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||
| 138 | my $hooks = $args{hooks} # make copy of calling hook-list | ||||||||||||||||||||||||||||||||
| 139 | 5 | ▶ | = $args{hooks} ? [ @{$args{hooks}} ] : []; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||
| 141 | 5 | my @mtom; | |||||||||||||||||||||||||||||||
| 142 | 5 | ▶ | push @$hooks, $self->_writer_xop_hook(\@mtom) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 143 | if _xop_enabled; | ||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||
| 145 | my ($body, $blabels) = $args{create_body} | ||||||||||||||||||||||||||||||||
| 146 | 5 | ▶ | ? $args{create_body}->($self, %args) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 147 | : $self->_writer_body(\%args); | ||||||||||||||||||||||||||||||||
| 148 | 5 | my ($faults, $flabels) = $self->_writer_faults(\%args, $args{faults}); | |||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||
| 150 | 5 | my ($header, $hlabels) = $self->_writer_header(\%args); | |||||||||||||||||||||||||||||||
| 151 | 5 | push @$hooks, $self->_writer_hook($self->envType('Header'), @$header); | |||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||
| 153 | 5 | ▶ | my $style = $args{style} || 'none'; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'style'} || 'none'
MC/DC0%0/1
$args{'style'} || 'none'
$args{'style'}
Truth table50%1/2
A
A= $args{'style'}
| |||||||||||||||||||||||||||||||||
| 154 | 5 | ▶ | if($style eq 'document') | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 155 | 5 | { push @$hooks, $self->_writer_hook($self->envType('Body') | |||||||||||||||||||||||||||||||
| 156 | , @$body, @$faults); | ||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||
| 158 | elsif($style eq 'rpc') | ||||||||||||||||||||||||||||||||
| 159 | { my $procedure = $args{procedure} || $args{body}{procedure} | ||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | or error __x"sending operation requires procedure name with RPC"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{'procedure'} || $args{'body'}{'procedure'}
MC/DC0%0/2
$args{'procedure'} || $args{'body'}{'procedure'}
$args{'procedure'}
$args{'body'}{'procedure'}
Truth table0%0/3
A || B
A= $args{'procedure'}B= $args{'body'}{'procedure'}
| |||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my $use = $args{use} || $args{body}{use} || 'literal'; | ||||||||||||||||||||||||||||||
|
Condition0%0/5
$args{'use'} || $args{'body'}{'use'} || 'literal'
$args{"use"} or $args{"body"}{"use"}
MC/DC0%0/2
$args{'use'} || $args{'body'}{'use'} || 'literal'
$args{"use"}
$args{"body"}{"use"}
Truth table0%0/3
A or B
A= $args{"use"}B= $args{"body"}{"use"}
| |||||||||||||||||||||||||||||||||
| 163 | 0 | my $bt = $self->envType('Body'); | |||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | push @$hooks, $use eq 'literal' | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 165 | ? $self->_writer_body_rpclit_hook($bt, $procedure, $body, $faults) | ||||||||||||||||||||||||||||||||
| 166 | : $self->_writer_body_rpcenc_hook($bt, $procedure, $body, $faults); | ||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||
| 168 | else | ||||||||||||||||||||||||||||||||
| 169 | 0 | { error __x"unknown style `{style}'", style => $style; | |||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||
| 172 | # | ||||||||||||||||||||||||||||||||
| 173 | # Pack everything together in one procedure | ||||||||||||||||||||||||||||||||
| 174 | # | ||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||
| 176 | 5 | my $envelope = $self->_writer($self->envType('Envelope'), %args); | |||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||
| 178 | sub | ||||||||||||||||||||||||||||||||
| 179 | 10 | ▶ | { my ($values, $charset) = ref $_[0] eq 'HASH' ? @_ : ( {@_}, undef); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=17 SCAR=32.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 180 | 10 | my %copy = %$values; # do not destroy the calling hash | |||||||||||||||||||||||||||||||
| 181 | my $doc = delete $copy{_doc} | ||||||||||||||||||||||||||||||||
| 182 | 10 | ▶ | || XML::LibXML::Document->new('1.0', $charset || 'UTF-8'); | ||||||||||||||||||||||||||||||
|
Condition40%2/5
delete $copy{'_doc'} || 'XML::LibXML::Document'->new('1.0', $charset || 'UTF-8')
$charset || 'UTF-8'
MC/DC0%0/2
delete $copy{'_doc'} || 'XML::LibXML::Document'->new('1.0', $charset || 'UTF-8')
delete $copy{'_doc'}
'XML::LibXML::Document'->new('1.0', $charset || 'UTF-8')
MC/DC0%0/1
$charset || 'UTF-8'
$charset
Truth table33%1/3
A || B
A= delete $copy{'_doc'}B= 'XML::LibXML::Document'->new('1.0', $charset || 'UTF-8')
Truth table50%1/2
A
A= $charset
| |||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||
| 184 | my %data = ( | ||||||||||||||||||||||||||||||||
| 185 | Body => delete $copy{Body} || {}, | ||||||||||||||||||||||||||||||||
| 186 | Header => delete $copy{Header}, | ||||||||||||||||||||||||||||||||
| 187 | 10 | ▶ | ); | ||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $copy{'Body'} || {}
MC/DC0%0/1
delete $copy{'Body'} || {}
delete $copy{'Body'}
Truth table50%1/2
A
A= delete $copy{'Body'}
| |||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||
| 189 | 10 | foreach my $label (@$hlabels) | |||||||||||||||||||||||||||||||
| 190 | 4 | ▶ | { exists $copy{$label} or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 191 | 3 | ▶ | $data{Header}{$label} ||= delete $copy{$label}; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$data{"Header"}{$label} ||= delete $copy{$label}
MC/DC0%0/2
$data{"Header"}{$label} ||= delete $copy{$label}
$data{"Header"}{$label}
delete $copy{$label}
Truth table33%1/3
A ||= B
A= $data{"Header"}{$label}B= delete $copy{$label}
| |||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||
| 194 | 10 | foreach my $label (@$blabels, @$flabels) | |||||||||||||||||||||||||||||||
| 195 | 20 | ▶ | { exists $copy{$label} or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 196 | 8 | ▶ | $data{Body}{$label} ||= delete $copy{$label}; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$data{"Body"}{$label} ||= delete $copy{$label}
MC/DC0%0/2
$data{"Body"}{$label} ||= delete $copy{$label}
$data{"Body"}{$label}
delete $copy{$label}
Truth table33%1/3
A ||= B
A= $data{"Body"}{$label}B= delete $copy{$label}
| |||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||
| 199 | 10 | ▶ | if(@$blabels==2 && !keys %{$data{Body}} ) # ignore 'Fault' | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
@$blabels == 2 and not keys %{$data{"Body"};}
MC/DC0%0/2
@$blabels == 2 and not keys %{$data{"Body"};}
@$blabels == 2
not keys %{$data{"Body"};}
Truth table66%2/3
A and not(B)
A= @$blabels == 2B= not keys %{$data{"Body"};}
| |||||||||||||||||||||||||||||||||
| 200 | { # even when no params, we fill at least one body element | ||||||||||||||||||||||||||||||||
| 201 | 0 | $data{Body}{$blabels->[0]} = \%copy; | |||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||
| 203 | elsif(keys %copy) | ||||||||||||||||||||||||||||||||
| 204 | 0 | { trace __x"available blocks: {blocks}", | |||||||||||||||||||||||||||||||
| 205 | blocks => [ sort @$hlabels, @$blabels, @$flabels ]; | ||||||||||||||||||||||||||||||||
| 206 | 0 | error __x"call data not used: {blocks}", blocks => [keys %copy]; | |||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||
| 209 | 10 | @mtom = (); # filled via hook | |||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||
| 211 | #use Data::Dumper; | ||||||||||||||||||||||||||||||||
| 212 | #warn "REPROCESSED: ", Dumper \%data; | ||||||||||||||||||||||||||||||||
| 213 | 10 | ▶ | my $root = $envelope->($doc, \%data) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 214 | or return; | ||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||
| 216 | 10 | $doc->setDocumentElement($root); | |||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||
| 218 | 10 | ▶ | return ($doc, \@mtom) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 219 | if wantarray; | ||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||
| 221 | 8 | ▶ | @mtom == 0 | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 222 | or error __x"{nr} XOP objects lost in sender" | ||||||||||||||||||||||||||||||||
| 223 | , nr => scalar @mtom; | ||||||||||||||||||||||||||||||||
| 224 | 8 | $doc; | |||||||||||||||||||||||||||||||
| 225 | 5 | }; | |||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||
| 228 | sub _writer_hook($$@) | ||||||||||||||||||||||||||||||||
| 229 | 10 | ▶ | { my ($self, $type, @do) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_writer_hook: called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||
| 231 | my $code = sub | ||||||||||||||||||||||||||||||||
| 232 | 13 | ▶ | { my ($doc, $data, $path, $tag) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=22.4
| |||||||||||||||||||||||||||||||||
| 233 | 13 | ▶ | UNIVERSAL::isa($data, 'XML::LibXML::Element') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 234 | and return $data; | ||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||
| 236 | 13 | my %data = %$data; | |||||||||||||||||||||||||||||||
| 237 | 13 | my @h = @do; | |||||||||||||||||||||||||||||||
| 238 | 13 | my @childs; | |||||||||||||||||||||||||||||||
| 239 | 13 | ▶ | while(@h) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 240 | 23 | { my ($k, $c) = (shift @h, shift @h); | |||||||||||||||||||||||||||||||
| 241 | 23 | ▶ | if(my $v = delete $data{$k}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 242 | 11 | { push @childs, $c->($doc, $v); | |||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||
| 246 | 13 | ▶ | if(keys %data) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 247 | 0 | { warning __x"unused values {names}", names => [keys %data]; | |||||||||||||||||||||||||||||||
| 248 | 0 | my @h = @do; my @keys; | |||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | while(@h) { push @keys, shift @h; shift @h} | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 250 | 0 | trace "expected: ". join ' ', @keys; | |||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||
| 253 | 13 | my $node = $doc->createElement($tag); | |||||||||||||||||||||||||||||||
| 254 | 13 | $node->appendChild($_) for @childs; | |||||||||||||||||||||||||||||||
| 255 | 13 | $node; | |||||||||||||||||||||||||||||||
| 256 | 10 | }; | |||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||
| 258 | 10 | +{ type => $type, replace => $code }; | |||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||
| 261 | sub _writer_body_rpclit_hook($$$$$) | ||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | { my ($self, $type, $procedure, $params, $faults) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_writer_body_rpclit_hook: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 263 | 0 | my @params = @$params; | |||||||||||||||||||||||||||||||
| 264 | 0 | my @faults = @$faults; | |||||||||||||||||||||||||||||||
| 265 | 0 | my $schemas = $self->schemas; | |||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||
| 267 | 0 | my $proc = $schemas->prefixed($procedure); | |||||||||||||||||||||||||||||||
| 268 | 0 | my ($prefix) = split /\:/, $proc; | |||||||||||||||||||||||||||||||
| 269 | 0 | my $prefdef = $schemas->prefix($prefix); | |||||||||||||||||||||||||||||||
| 270 | 0 | my $proc_ns = $prefdef->{uri}; | |||||||||||||||||||||||||||||||
| 271 | 0 | $prefdef->{used} = 0; | |||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||
| 273 | my $code = sub | ||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | { my ($doc, $data, $path, $tag) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | UNIVERSAL::isa($data, 'XML::LibXML::Element') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 276 | and return $data; | ||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||
| 278 | 0 | my %data = %$data; | |||||||||||||||||||||||||||||||
| 279 | 0 | my @f = @faults; | |||||||||||||||||||||||||||||||
| 280 | 0 | my (@fchilds, @pchilds); | |||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | while(@f) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 282 | 0 | { my ($k, $c) = (shift @f, shift @f); | |||||||||||||||||||||||||||||||
| 283 | 0 | my $v = delete $data{$k}; | |||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | push @fchilds, $c->($doc, $v) if defined $v; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||
| 286 | 0 | my @p = @params; | |||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | while(@p) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 288 | 0 | { my ($k, $c) = (shift @p, shift @p); | |||||||||||||||||||||||||||||||
| 289 | 0 | my $v = delete $data{$k}; | |||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | push @pchilds, $c->($doc, $v) if defined $v; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | warning __x"unused values {names}", names => [keys %data] | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 293 | if keys %data; | ||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||
| 295 | 0 | my $proc = $doc->createElement($proc); | |||||||||||||||||||||||||||||||
| 296 | 0 | $proc->setNamespace($proc_ns, $prefix, 0); | |||||||||||||||||||||||||||||||
| 297 | 0 | $proc->setAttribute("SOAP-ENV:encodingStyle", SOAP11ENC); | |||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||
| 299 | 0 | $proc->appendChild($_) for @pchilds; | |||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||
| 301 | 0 | my $node = $doc->createElement($tag); | |||||||||||||||||||||||||||||||
| 302 | 0 | $node->appendChild($proc); | |||||||||||||||||||||||||||||||
| 303 | 0 | $node->appendChild($_) for @fchilds; | |||||||||||||||||||||||||||||||
| 304 | 0 | $node; | |||||||||||||||||||||||||||||||
| 305 | 0 | }; | |||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||
| 307 | 0 | +{ type => $type, replace => $code }; | |||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||
| 310 | 7 | *_writer_body_rpcenc_hook = \&_writer_body_rpclit_hook; | |||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||
| 312 | sub _writer_header($) | ||||||||||||||||||||||||||||||||
| 313 | 5 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_writer_header: called CC=8 SCAR=24.9
| |||||||||||||||||||||||||||||||||
| 314 | 5 | my (@rules, @hlabels); | |||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||
| 316 | 5 | ▶ | my $header = $args->{header} || []; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'header'} || []
MC/DC100%1/1
$args->{'header'} || []
$args->{'header'}
Truth table100%2/2
A
A= $args->{'header'}
| |||||||||||||||||||||||||||||||||
| 317 | 5 | my $soapenv = $self->envelopeNS; | |||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||
| 319 | 5 | ▶ | foreach my $h (ref $header eq 'ARRAY' ? @$header : $header) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 320 | 2 | { my $part = $h->{parts}[0]; | |||||||||||||||||||||||||||||||
| 321 | 2 | my $label = $part->{name}; | |||||||||||||||||||||||||||||||
| 322 | 2 | my $code = $part->{writer}; | |||||||||||||||||||||||||||||||
| 323 | 2 | ▶ | if($part->{element}) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 324 | 2 | ▶ | { $code ||= $self->_writer_part_element($args, $part); | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$code ||= $self->_writer_part_element($args, $part)
MC/DC0%0/2
$code ||= $self->_writer_part_element($args, $part)
$code
$self->_writer_part_element($args, $part)
Truth table33%1/3
A ||= B
A= $codeB= $self->_writer_part_element($args, $part)
| |||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||
| 326 | elsif(my $type = $part->{type}) | ||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | { $code ||= $self->_writer_part_type($args, $part); | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$code ||= $self->_writer_part_type($args, $part)
MC/DC0%0/2
$code ||= $self->_writer_part_type($args, $part)
$code
$self->_writer_part_type($args, $part)
Truth table0%0/3
A ||= B
A= $codeB= $self->_writer_part_type($args, $part)
| |||||||||||||||||||||||||||||||||
| 328 | 0 | $label = (unpack_type $part->{name})[1]; | |||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||
| 330 | else | ||||||||||||||||||||||||||||||||
| 331 | 0 | { error __x"header part {name} has neither `element' nor `type'" | |||||||||||||||||||||||||||||||
| 332 | , name => $label; | ||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||
| 335 | 2 | push @rules, $label => $code; | |||||||||||||||||||||||||||||||
| 336 | 2 | push @hlabels, $label; | |||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||
| 339 | 5 | (\@rules, \@hlabels); | |||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||
| 342 | sub _writer_body($) | ||||||||||||||||||||||||||||||||
| 343 | 5 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_writer_body: called CC=8 SCAR=23.6
| |||||||||||||||||||||||||||||||||
| 344 | 5 | my (@rules, @blabels); | |||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||
| 346 | 5 | ▶ | my $body = $args->{body} || $args->{fault}; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$args->{'body'} || $args->{'fault'}
MC/DC0%0/2
$args->{'body'} || $args->{'fault'}
$args->{'body'}
$args->{'fault'}
Truth table33%1/3
A || B
A= $args->{'body'}B= $args->{'fault'}
| |||||||||||||||||||||||||||||||||
| 347 | 5 | ▶ | my $use = $body->{use} || 'literal'; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$body->{'use'} || 'literal'
MC/DC100%1/1
$body->{'use'} || 'literal'
$body->{'use'}
Truth table100%2/2
A
A= $body->{'use'}
| |||||||||||||||||||||||||||||||||
| 348 | # $use eq 'literal' | ||||||||||||||||||||||||||||||||
| 349 | # or error __x"RPC encoded not supported by this version"; | ||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||
| 351 | 5 | ▶ | my $parts = $body->{parts} || []; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$body->{'parts'} || []
MC/DC0%0/1
$body->{'parts'} || []
$body->{'parts'}
Truth table50%1/2
A
A= $body->{'parts'}
| |||||||||||||||||||||||||||||||||
| 352 | 5 | my $style = $args->{style}; | |||||||||||||||||||||||||||||||
| 353 | 5 | ▶ | local $args->{is_rpc_enc} = $style eq 'rpc' && $use eq 'encoded'; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$style eq 'rpc' && $use eq 'encoded'
MC/DC0%0/2
$style eq 'rpc' && $use eq 'encoded'
$style eq 'rpc'
$use eq 'encoded'
Truth table33%1/3
A && B
A= $style eq 'rpc'B= $use eq 'encoded'
| |||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||
| 355 | 5 | foreach my $part (@$parts) | |||||||||||||||||||||||||||||||
| 356 | 9 | { my $label = $part->{name}; | |||||||||||||||||||||||||||||||
| 357 | 9 | my $code; | |||||||||||||||||||||||||||||||
| 358 | 9 | ▶ | if($part->{element}) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 359 | 9 | { $code = $self->_writer_part_element($args, $part); | |||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||
| 361 | elsif(my $type = $part->{type}) | ||||||||||||||||||||||||||||||||
| 362 | 0 | { $code = $self->_writer_part_type($args, $part); | |||||||||||||||||||||||||||||||
| 363 | 0 | $label = (unpack_type $part->{name})[1]; | |||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||
| 365 | else | ||||||||||||||||||||||||||||||||
| 366 | 0 | { error __x"body part {name} has neither `element' nor `type'" | |||||||||||||||||||||||||||||||
| 367 | , name => $label; | ||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||
| 370 | 9 | push @rules, $label => $code; | |||||||||||||||||||||||||||||||
| 371 | 9 | push @blabels, $label; | |||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||
| 374 | 5 | (\@rules, \@blabels); | |||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||
| 377 | sub _writer_part_element($$) | ||||||||||||||||||||||||||||||||
| 378 | 11 | ▶ | { my ($self, $args, $part) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_writer_part_element: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||
| 379 | 11 | my $element = $part->{element}; | |||||||||||||||||||||||||||||||
| 380 | 11 | my $soapenv = $self->envelopeNS; | |||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||
| 382 | $part->{writer} ||= $self->_writer | ||||||||||||||||||||||||||||||||
| 383 | ( $element, %$args | ||||||||||||||||||||||||||||||||
| 384 | 30 | ▶ | , include_namespaces => sub {$_[0] ne $soapenv && $_[2]} | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 385 | , xsi_type_everywhere => $args->{is_rpc_enc} | ||||||||||||||||||||||||||||||||
| 386 | 11 | ▶ | ); | ||||||||||||||||||||||||||||||
|
Condition66%2/3
$part->{"writer"} ||= $self->_writer($element, %$args, "include_namespaces", sub {
$_[0] ne $soapenv and $_[2];
}
, "xsi_type_everywhere", $args->{"is_rpc_enc"})
MC/DC0%0/2
$part->{"writer"} ||= $self->_writer($element, %$args, "include_namespaces", sub {
$_[0] ne $soapenv and $_[2];
}
, "xsi_type_everywhere", $args->{"is_rpc_enc"})
$part->{"writer"}
$self->_writer($element, %$args, "include_namespaces", sub {
$_[0] ne $soapenv and $_[2];
}
, "xsi_type_everywhere", $args->{"is_rpc_enc"})
Truth table66%2/3
A ||= B
A= $part->{"writer"}B= $self->_writer($element, %$args, "include_namespaces", sub {
$_[0] ne $soapenv and $_[2];
}
, "xsi_type_everywhere", $args->{"is_rpc_enc"})
| |||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||
| 389 | sub _writer_part_type($$) | ||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | { my ($self, $args, $part) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_writer_part_type: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||
| 392 | $args->{style} eq 'rpc' | ||||||||||||||||||||||||||||||||
| 393 | or error __x"part {name} uses `type', only for rpc not {style}" | ||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | , name => $part->{name}, style => $args->{style}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||
| 396 | return $part->{writer} | ||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | if $part->{writer}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||
| 399 | 0 | my $soapenv = $self->envelopeNS; | |||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||
| 401 | $part->{writer} = $self->schemas->compileType | ||||||||||||||||||||||||||||||||
| 402 | ( WRITER => $part->{type}, %$args, element => $part->{name} | ||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | , include_namespaces => sub {$_[0] ne $soapenv && $_[2]} | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 404 | , xsi_type_everywhere => $args->{is_rpc_enc} | ||||||||||||||||||||||||||||||||
| 405 | 0 | ); | |||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | sub _writer_faults($) { ([], []) } | ||||||||||||||||||||||||||||||
|
Subroutine
_writer_faults: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||
| 410 | sub _writer_xop_hook($) | ||||||||||||||||||||||||||||||||
| 411 | 1 | ▶ | { my ($self, $xop_objects) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_writer_xop_hook: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||
| 413 | my $collect_objects = sub { | ||||||||||||||||||||||||||||||||
| 414 | 4 | ▶ | my ($doc, $val, $path, $tag, $r) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 415 | 4 | ▶ | return $r->($doc, $val) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 416 | unless UNIVERSAL::isa($val, 'XML::Compile::XOP::Include'); | ||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||
| 418 | 1 | my $node = $val->xmlNode($doc, $path, $tag); | |||||||||||||||||||||||||||||||
| 419 | 1 | push @$xop_objects, $val; | |||||||||||||||||||||||||||||||
| 420 | 1 | $node; | |||||||||||||||||||||||||||||||
| 421 | 1 | }; | |||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||
| 423 | 1 | +{ extends => 'xsd:base64Binary', replace => $collect_objects }; | |||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||
| 426 | #------------------------------------------------ | ||||||||||||||||||||||||||||||||
| 427 | # Receiver | ||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||
| 429 | sub _receiver(@) | ||||||||||||||||||||||||||||||||
| 430 | 6 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_receiver: called CC=14 SCAR=34.0
| |||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||
| 432 | error __"option 'destination' only for writers" | ||||||||||||||||||||||||||||||||
| 433 | 6 | ▶ | if $args{destination}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||
| 435 | error __"option 'mustUnderstand' only for writers" | ||||||||||||||||||||||||||||||||
| 436 | 6 | ▶ | if $args{understand}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||
| 438 | # roles are not checked (yet) | ||||||||||||||||||||||||||||||||
| 439 | # my $roles = $args{roles} || $args{role} || 'ULTIMATE'; | ||||||||||||||||||||||||||||||||
| 440 | # my @roles = ref $roles eq 'ARRAY' ? @$roles : $roles; | ||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||
| 442 | 6 | my $header = $self->_reader_header(\%args); | |||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||
| 444 | 6 | my $xops; # forward backwards pass-on | |||||||||||||||||||||||||||||||
| 445 | 6 | my $body = $self->_reader_body(\%args, \$xops); | |||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||
| 447 | 6 | ▶ | my $style = $args{style} || 'document'; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'style'} || 'document'
MC/DC0%0/1
$args{'style'} || 'document'
$args{'style'}
Truth table50%1/2
A
A= $args{'style'}
| |||||||||||||||||||||||||||||||||
| 448 | 6 | ▶ | my $kind = $args{kind} || 'request-response'; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'kind'} || 'request-response'
MC/DC0%0/1
$args{'kind'} || 'request-response'
$args{'kind'}
Truth table50%1/2
A
A= $args{'kind'}
| |||||||||||||||||||||||||||||||||
| 449 | 6 | ▶ | if($style eq 'rpc') | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 450 | 0 | ▶ | { my $procedure = $args{procedure} || $args{body}{procedure}; | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'procedure'} || $args{'body'}{'procedure'}
MC/DC0%0/2
$args{'procedure'} || $args{'body'}{'procedure'}
$args{'procedure'}
$args{'body'}{'procedure'}
Truth table0%0/3
A || B
A= $args{'procedure'}B= $args{'body'}{'procedure'}
| |||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | keys %{$args{body}}==0 || $procedure | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
keys %{$args{"body"};} == 0 or $procedure
MC/DC0%0/2
keys %{$args{"body"};} == 0 or $procedure
keys %{$args{"body"};} == 0
$procedure
Truth table0%0/3
A or B
A= keys %{$args{"body"};} == 0B= $procedure
| |||||||||||||||||||||||||||||||||
| 452 | or error __x"receiving operation requires procedure name with RPC"; | ||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | my $use = $args{use} || $args{body}{use} || 'literal'; | ||||||||||||||||||||||||||||||
|
Condition0%0/5
$args{'use'} || $args{'body'}{'use'} || 'literal'
$args{"use"} or $args{"body"}{"use"}
MC/DC0%0/2
$args{'use'} || $args{'body'}{'use'} || 'literal'
$args{"use"}
$args{"body"}{"use"}
Truth table0%0/3
A or B
A= $args{"use"}B= $args{"body"}{"use"}
| |||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | $body = $use eq 'literal' | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 456 | ? $self->_reader_body_rpclit_wrapper($procedure, $body) | ||||||||||||||||||||||||||||||||
| 457 | : $self->_reader_body_rpcenc_wrapper($procedure, $body); | ||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||
| 459 | elsif($style ne 'document') | ||||||||||||||||||||||||||||||||
| 460 | 0 | { error __x"unknown style `{style}'", style => $style; | |||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||
| 463 | # faults are always possible | ||||||||||||||||||||||||||||||||
| 464 | 6 | push @$body, $self->_reader_fault_reader; | |||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||
| 466 | 6 | ▶ | my @hooks = @{$self->{hooks} || []}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 467 | 6 | push @hooks | |||||||||||||||||||||||||||||||
| 468 | , $self->_reader_hook($self->envType('Header'), $header) | ||||||||||||||||||||||||||||||||
| 469 | , $self->_reader_hook($self->envType('Body'), $body ); | ||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||
| 471 | # | ||||||||||||||||||||||||||||||||
| 472 | # Pack everything together in one procedure | ||||||||||||||||||||||||||||||||
| 473 | # | ||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||
| 475 | 6 | my $envelope = $self->_reader($self->envType('Envelope') | |||||||||||||||||||||||||||||||
| 476 | , %args, hooks => \@hooks); | ||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||
| 478 | # add simplified fault information | ||||||||||||||||||||||||||||||||
| 479 | 6 | my $faultdec = $self->_reader_faults(\%args, $args{faults}); | |||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||
| 481 | sub | ||||||||||||||||||||||||||||||||
| 482 | 9 | ▶ | { (my $xml, $xops) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||
| 483 | 9 | my $data = $envelope->($xml); | |||||||||||||||||||||||||||||||
| 484 | 9 | ▶ | my @pairs = ( %{delete $data->{Header} || {}} | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 485 | 9 | ▶ | , %{delete $data->{Body} || {}}); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 486 | 9 | ▶ | while(@pairs) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 487 | 10 | { my $k = shift @pairs; | |||||||||||||||||||||||||||||||
| 488 | 10 | $data->{$k} = shift @pairs; | |||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||
| 491 | 9 | $faultdec->($data); | |||||||||||||||||||||||||||||||
| 492 | 9 | $data; | |||||||||||||||||||||||||||||||
| 493 | 6 | }; | |||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||
| 496 | sub _reader_hook($$) | ||||||||||||||||||||||||||||||||
| 497 | 12 | ▶ | { my ($self, $type, $do) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_reader_hook: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||
| 498 | 12 | my %trans = map +($_->[1] => [ $_->[0], $_->[2] ]), @$do; # we need copies | |||||||||||||||||||||||||||||||
| 499 | 12 | my $envns = $self->envelopeNS; | |||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||
| 501 | my $code = sub | ||||||||||||||||||||||||||||||||
| 502 | 12 | ▶ | { my ($xml, $trans, $path, $label) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=25.3
| |||||||||||||||||||||||||||||||||
| 503 | 12 | my %h; | |||||||||||||||||||||||||||||||
| 504 | 12 | foreach my $child ($xml->childNodes) | |||||||||||||||||||||||||||||||
| 505 | 23 | ▶ | { next unless $child->isa('XML::LibXML::Element'); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 506 | 10 | my $type = type_of_node $child; | |||||||||||||||||||||||||||||||
| 507 | 10 | ▶ | if(my $t = $trans{$type}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 508 | 9 | { my ($label, $code) = @$t; | |||||||||||||||||||||||||||||||
| 509 | 9 | ▶ | my $v = $code->($child) or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 510 | 9 | ▶ | if(!defined $v) { } | ||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||
| 511 | 9 | elsif(!exists $h{$label}) { $h{$label} = $v } | |||||||||||||||||||||||||||||||
| 512 | 0 | elsif(ref $h{$label} eq 'ARRAY') { push @{$h{$label}}, $v } | |||||||||||||||||||||||||||||||
| 513 | 0 | else { $h{$label} = [ $h{$label}, $v ] } | |||||||||||||||||||||||||||||||
| 514 | 9 | next; | |||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||
| 516 | else | ||||||||||||||||||||||||||||||||
| 517 | 1 | { $h{$type} = $child; | |||||||||||||||||||||||||||||||
| 518 | 1 | trace __x"node {type} not understood, expected are {has}", | |||||||||||||||||||||||||||||||
| 519 | type => $type, has => [sort keys %trans]; | ||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||
| 522 | 1 | ▶ | return ($label => $self->replyMustUnderstandFault($type)) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$child->getAttributeNS($envns, "mustUnderstand") or 0
MC/DC0%0/1
$child->getAttributeNS($envns, "mustUnderstand") or 0
$child->getAttributeNS($envns, "mustUnderstand")
Truth table50%1/2
A
A= $child->getAttributeNS($envns, "mustUnderstand")
| |||||||||||||||||||||||||||||||||
| 523 | if $child->getAttributeNS($envns, 'mustUnderstand') || 0; | ||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||
| 525 | 11 | ($label => \%h); | |||||||||||||||||||||||||||||||
| 526 | 12 | }; | |||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||
| 528 | 12 | +{ type => $type | |||||||||||||||||||||||||||||||
| 529 | , replace => $code | ||||||||||||||||||||||||||||||||
| 530 | }; | ||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||
| 534 | sub _reader_body_rpclit_wrapper($$) | ||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | { my ($self, $procedure, $body) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_reader_body_rpclit_wrapper: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 536 | 0 | my %trans = map +($_->[1] => [ $_->[0], $_->[2] ]), @$body; | |||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||
| 538 | # this should use key_rewrite, but there is no $wsdl here | ||||||||||||||||||||||||||||||||
| 539 | # my $label = $wsdl->prefixed($procedure); | ||||||||||||||||||||||||||||||||
| 540 | 0 | my $label = (unpack_type $procedure)[1]; | |||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||
| 542 | my $code = sub | ||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | { my $xml = shift or return {}; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 544 | 0 | my %h; | |||||||||||||||||||||||||||||||
| 545 | 0 | foreach my $child ($xml->childNodes) | |||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | { $child->isa('XML::LibXML::Element') or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 547 | 0 | my $type = type_of_node $child; | |||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | if(my $t = $trans{$type}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 549 | 0 | { $h{$t->[0]} = $t->[1]->($child) } | |||||||||||||||||||||||||||||||
| 550 | 0 | else { $h{$type} = $child } | |||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||
| 552 | 0 | \%h; | |||||||||||||||||||||||||||||||
| 553 | 0 | }; | |||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||
| 555 | 0 | [ [ $label => $procedure => $code ] ]; | |||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||
| 558 | sub _reader_header($) | ||||||||||||||||||||||||||||||||
| 559 | 6 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_reader_header: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||
| 560 | 6 | ▶ | my $header = $args->{header} || []; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'header'} || []
MC/DC100%1/1
$args->{'header'} || []
$args->{'header'}
Truth table100%2/2
A
A= $args->{'header'}
| |||||||||||||||||||||||||||||||||
| 561 | 6 | my @rules; | |||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||
| 563 | 6 | foreach my $h (@$header) | |||||||||||||||||||||||||||||||
| 564 | 2 | { my $part = $h->{parts}[0]; | |||||||||||||||||||||||||||||||
| 565 | 2 | my $label = $part->{name}; | |||||||||||||||||||||||||||||||
| 566 | 2 | my $element = $part->{element}; | |||||||||||||||||||||||||||||||
| 567 | 2 | ▶ | my $code = $part->{reader} ||= $self->_reader($element, %$args); | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$part->{"reader"} ||= $self->_reader($element, %$args)
MC/DC0%0/2
$part->{"reader"} ||= $self->_reader($element, %$args)
$part->{"reader"}
$self->_reader($element, %$args)
Truth table33%1/3
A ||= B
A= $part->{"reader"}B= $self->_reader($element, %$args)
| |||||||||||||||||||||||||||||||||
| 568 | 2 | push @rules, [$label, $element, $code]; | |||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||
| 571 | 6 | \@rules; | |||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||
| 574 | sub _reader_body($$) | ||||||||||||||||||||||||||||||||
| 575 | 6 | ▶ | { my ($self, $args, $refxops) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_reader_body: called CC=7 SCAR=20.2
| |||||||||||||||||||||||||||||||||
| 576 | 6 | my $body = $args->{body}; | |||||||||||||||||||||||||||||||
| 577 | 6 | ▶ | my $parts = $body->{parts} || []; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$body->{'parts'} || []
MC/DC100%1/1
$body->{'parts'} || []
$body->{'parts'}
Truth table100%2/2
A
A= $body->{'parts'}
| |||||||||||||||||||||||||||||||||
| 578 | 6 | ▶ | my @hooks = @{$args->{hooks} || []}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 579 | 6 | ▶ | push @hooks, $self->_reader_xop_hook($refxops) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 580 | if _xop_enabled; | ||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||
| 582 | 6 | local $args->{hooks} = \@hooks; | |||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||
| 584 | 6 | my @rules; | |||||||||||||||||||||||||||||||
| 585 | 6 | foreach my $part (@$parts) | |||||||||||||||||||||||||||||||
| 586 | 4 | { my $label = $part->{name}; | |||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||
| 588 | 4 | my ($t, $code); | |||||||||||||||||||||||||||||||
| 589 | 4 | ▶ | if($part->{element}) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 590 | 4 | { ($t, $code) = $self->_reader_body_element($args, $part) } | |||||||||||||||||||||||||||||||
| 591 | elsif($part->{type}) | ||||||||||||||||||||||||||||||||
| 592 | 0 | { ($t, $code) = $self->_reader_body_type($args, $part) } | |||||||||||||||||||||||||||||||
| 593 | else | ||||||||||||||||||||||||||||||||
| 594 | 0 | { error __x"part {name} has neither element nor type specified" | |||||||||||||||||||||||||||||||
| 595 | , name => $label; | ||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||
| 597 | 4 | push @rules, [ $label, $t, $code ]; | |||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||
| 600 | #use Data::Dumper; | ||||||||||||||||||||||||||||||||
| 601 | #warn "RULES=", Dumper \@rules, $parts; | ||||||||||||||||||||||||||||||||
| 602 | 6 | \@rules; | |||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||
| 605 | sub _reader_body_element($$) | ||||||||||||||||||||||||||||||||
| 606 | 4 | ▶ | { my ($self, $args, $part) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_reader_body_element: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||
| 608 | 4 | my $element = $part->{element}; | |||||||||||||||||||||||||||||||
| 609 | 4 | ▶ | my $code = $part->{reader} || $self->_reader($element, %$args); | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$part->{'reader'} || $self->_reader($element, %$args)
MC/DC0%0/2
$part->{'reader'} || $self->_reader($element, %$args)
$part->{'reader'}
$self->_reader($element, %$args)
Truth table33%1/3
A || B
A= $part->{'reader'}B= $self->_reader($element, %$args)
| |||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||
| 611 | 4 | ($element, $code); | |||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||
| 614 | sub _reader_body_type($$) | ||||||||||||||||||||||||||||||||
| 615 | 0 | ▶ | { my ($self, $args, $part) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_reader_body_type: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 616 | 0 | my $name = $part->{name}; | |||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | $args->{style} eq 'rpc' | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 619 | or error __x"only rpc style messages can use 'type' as used by {part}" | ||||||||||||||||||||||||||||||||
| 620 | , part => $name; | ||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||
| 622 | return $part->{reader} | ||||||||||||||||||||||||||||||||
| 623 | 0 | ▶ | if $part->{reader}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||
| 625 | 0 | my $type = $part->{type}; | |||||||||||||||||||||||||||||||
| 626 | 0 | my ($ns, $local) = unpack_type $type; | |||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||
| 628 | my $r = $part->{reader} = | ||||||||||||||||||||||||||||||||
| 629 | 0 | $self->schemas->compileType | |||||||||||||||||||||||||||||||
| 630 | ( READER => $type, %$args | ||||||||||||||||||||||||||||||||
| 631 | , element => $name # $args->{body}{procedure} | ||||||||||||||||||||||||||||||||
| 632 | ); | ||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||
| 634 | 0 | ($name, $r); | |||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||
| 637 | sub _reader_faults($) | ||||||||||||||||||||||||||||||||
| 638 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_reader_faults: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 639 | 0 | ▶ | sub { shift }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||
| 642 | sub _reader_xop_hook($) | ||||||||||||||||||||||||||||||||
| 643 | 1 | ▶ | { my ($self, $refxops) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_reader_xop_hook: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||
| 645 | my $xop_merge = sub | ||||||||||||||||||||||||||||||||
| 646 | 4 | ▶ | { my ($xml, $args, $path, $type, $r) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.5
| |||||||||||||||||||||||||||||||||
| 647 | 4 | ▶ | if(my $incls = $xml->getElementsByTagNameNS(XOP10, 'Include')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 648 | 1 | ▶ | { my $href = $incls->shift->getAttribute('href') || '' | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$incls->shift->getAttribute('href') || ''
MC/DC0%0/1
$incls->shift->getAttribute('href') || ''
$incls->shift->getAttribute('href')
Truth table50%1/2
A
A= $incls->shift->getAttribute('href')
| |||||||||||||||||||||||||||||||||
| 649 | or return ($type => $xml); | ||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||
| 651 | 1 | $href =~ s/^cid://; | |||||||||||||||||||||||||||||||
| 652 | 1 | ▶ | my $xop = $$refxops->{$href} | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 653 | or return ($type => $xml); | ||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||
| 655 | 1 | return ($type => $xop); | |||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||
| 658 | 3 | ($type => decode_base64 $xml->textContent); | |||||||||||||||||||||||||||||||
| 659 | 1 | }; | |||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||
| 661 | 1 | +{ type => 'xsd:base64Binary', replace => $xop_merge }; | |||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||
| 664 | 12 | ▶ | sub _reader(@) { shift->schemas->reader(@_) } | ||||||||||||||||||||||||||||||
|
Subroutine
_reader: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 665 | 17 | ▶ | sub _writer(@) { shift->schemas->writer(@_) } | ||||||||||||||||||||||||||||||
|
Subroutine
_writer: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||
| 667 | #------------------------------------------------ | ||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||
| 670 | 0 | ▶ | sub roleURI($) { panic "not implemented" } | ||||||||||||||||||||||||||||||
|
Subroutine
roleURI: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||
| 673 | 0 | ▶ | sub roleAbbreviation($) { panic "not implemented" } | ||||||||||||||||||||||||||||||
|
Subroutine
roleAbbreviation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | sub replyMustUnderstandFault($) { panic "not implemented" } | ||||||||||||||||||||||||||||||
|
Subroutine
replyMustUnderstandFault: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||
| 678 | #---------------------- | ||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||
| 681 | 7 | 1; | |||||||||||||||||||||||||||||||