| 1 | package Net::Journyx::SOAP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 10 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use XML::Compile::Util qw/pack_type/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | #use Log::Report mode => 'DEBUG'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 10 | has jx => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | isa => 'Net::Journyx', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | weak_ref => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | my $current_wsdl = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 10 | my %API_CACHE = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | has wsdl => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | default => sub { return shift->jx->wsdl }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | has wsdl_document => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | return $API_CACHE{'document'} if $API_CACHE{'document'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | require File::Temp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $tmp = new File::Temp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my $url = $self->wsdl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my $ua = $self->jx->ua; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $response = $ua->get( $url, ':content_file' => "$tmp" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | unless ( $response->is_success ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | die "Request to '$url' failed. Server response:\n". $response->status_line ."\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | $tmp->seek(0,0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | require XML::LibXML; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $parser = new XML::LibXML; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | return $API_CACHE{'document'} = $parser->parse_fh( $tmp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | has transport => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | require XML::Compile::Transport::SOAPHTTP; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | return XML::Compile::Transport::SOAPHTTP->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | address => $self->jx->site, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | user_agent => $self->jx->ua, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | keep_alive => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | )->compileClient; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | has batch_transport => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $address = $self->jx->site; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $address =~ s/jxapi\.pyc$/soap_cgi.pyc/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | require XML::Compile::Transport::SOAPHTTP; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | return XML::Compile::Transport::SOAPHTTP->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | address => $address, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | user_agent => $self->jx->ua, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | keep_alive => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | )->compileClient; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | has client => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | isa => 'XML::Compile::SOAP::Client', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | return $API_CACHE{'client'} if $API_CACHE{'client'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | require XML::Compile::SOAP11::Client; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my $res = new XML::Compile::SOAP11::Client; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $res->schemas->importDefinitions( $self->wsdl_document ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | return $API_CACHE{'client'} = $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | has schema => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # isa => 'XML::Compile::SOAP::Client', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | return (shift->wsdl_document->findnodes('//xsd:schema'))[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | has encoder => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | return $self->client->compileMessage(SENDER => style => 'rpc-encoded'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | has decoder => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | return $self->client->compileMessage(RECEIVER => style => 'rpc-encoded'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | has namespace => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | default => sub { 'urn:jxapi' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | has API => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | return $API_CACHE{'API'} if $API_CACHE{'API'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my %res = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $doc = $self->wsdl_document; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my @ops = $doc->findnodes('//wsdl:portType/wsdl:operation'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | foreach my $op ( @ops ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $name = $op->getAttribute("name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $order = $op->getAttribute("parameterOrder"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $res{$name}{'order'} = [ split /\s+/, $order ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | foreach my $dir (qw(input output)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my $type = $op->find("wsdl:$dir")->shift->getAttribute('name'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my @parts = $doc->findnodes('//wsdl:message[@name = "'.$type.'"]/wsdl:part'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | foreach my $part ( @parts ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $res{$name}{$dir .'_type'}{ $part->getAttribute('name') } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | = $part->getAttribute('type'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | return $API_CACHE{'API'} = \%res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | return unless my $jx = $_[1]->{'jx'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | unless ( $current_wsdl eq $jx->wsdl ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | %API_CACHE = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $current_wsdl = $jx->wsdl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 10 | ▶ | sub install_basic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_basic: called CC=3 SCAR=12.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 10 | ▶ | my $into = shift || caller; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
shift() || caller
MC/DC0%0/2
shift() || caller
shift()
caller
Truth table33%1/3
A || B
A= shift()B= caller
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 10 | foreach my $operation ( @_ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 180 | my $name = $self->nocapitals( $operation ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | $into->meta->add_method( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | $name => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
admin_telephone: not called CC=1 SCAR=6.9
Subroutine
admin_name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | return (shift)->soap->basic_call($operation, @_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 180 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 10 | our $IN_LOGIN_RETRY = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | sub basic_call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
basic_call: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $op = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my ($answer, $trace) = $self->call( $op => %args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | unless ( exists $answer->{ $op .'Response' } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if ( $op ne 'logout' && $op ne 'login' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$op ne "logout" and $op ne "login" and not $Net::Journyx::SOAP::IN_LOGIN_RETRY and $answer->{"Fault"}{"faultstring"} eq "session timed out or invalid token"
$op ne "logout" and $op ne "login" and not $Net::Journyx::SOAP::IN_LOGIN_RETRY
$op ne "logout" and $op ne "login"
MC/DC0%0/4
$op ne "logout" and $op ne "login" and not $Net::Journyx::SOAP::IN_LOGIN_RETRY and $answer->{"Fault"}{"faultstring"} eq "session timed out or invalid token"
$op ne "logout"
$op ne "login"
not $Net::Journyx::SOAP::IN_LOGIN_RETRY
$answer->{"Fault"}{"faultstring"} eq "session timed out or invalid token"
Truth table0%0/5
A and B and not(C) and D
A= $op ne "logout"B= $op ne "login"C= not $Net::Journyx::SOAP::IN_LOGIN_RETRYD= $answer->{"Fault"}{"faultstring"} eq "session timed out or invalid token"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | && !$IN_LOGIN_RETRY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | && $answer->{'Fault'}{'faultstring'} eq 'session timed out or invalid token' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $self->jx->clear_session; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | local $IN_LOGIN_RETRY = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | return $self->basic_call( $op => %args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $exception = 'XXX IMPLEMENT ME!'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | die "Couldn't run function $op: ". Dumper( $answer ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $res = $answer->{ $op .'Response' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | return ($res, $trace) if wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | sub call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | return (shift)->create_call(shift)->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | sub batch_call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
batch_call: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my ($answer, $trace) = $self->create_batch_call->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | unless ( exists $answer->{ 'jxAPIBatchResponse' }{'Result'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if ( !$IN_LOGIN_RETRY && $answer->{'Fault'}{'faultstring'} eq 'session timed out or invalid token' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $Net::Journyx::SOAP::IN_LOGIN_RETRY and $answer->{"Fault"}{"faultstring"} eq "session timed out or invalid token"
MC/DC0%0/2
not $Net::Journyx::SOAP::IN_LOGIN_RETRY and $answer->{"Fault"}{"faultstring"} eq "session timed out or invalid token"
not $Net::Journyx::SOAP::IN_LOGIN_RETRY
$answer->{"Fault"}{"faultstring"} eq "session timed out or invalid token"
Truth table0%0/3
not(A) and B
A= not $Net::Journyx::SOAP::IN_LOGIN_RETRYB= $answer->{"Fault"}{"faultstring"} eq "session timed out or invalid token"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | $self->jx->clear_session; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | local $IN_LOGIN_RETRY = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | return $self->batch_call( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my $exception = 'XXX IMPLEMENT ME!'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | die "Couldn't run function jxAPIBatch: ". Dumper( $answer ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $res = $answer->{ 'jxAPIBatchResponse' }{'Result'}{'results'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | $res = [ $res ] unless ref $res eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub create_call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_call: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | my $out = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my ($soap, $doc, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $ns = $self->namespace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $soap->encAddNamespace( typens => $ns ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | return $soap->struct( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | pack_type($ns, $name), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | $self->pack_method_arguments( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | soap => $soap, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | arguments => { @$data } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | my $in = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my ($soap, @msgs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # XXX: refactor me into something more elegant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | require Net::Journyx::SOAP::Encoding; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my $old = ref $soap; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | bless $soap, 'Net::Journyx::SOAP::Encoding'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my $tree = $soap->dec(@msgs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | $rv = $soap->decSimplify($tree) if $tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | bless $soap, $old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | return $rv? $rv : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | return $self->_create_call( $name, $out, $in ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub create_batch_call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_batch_call: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | my $out = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my ($soap, $doc, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my $ns = $self->namespace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $soap->encAddNamespace( typens => $ns ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $soap->encAddNamespace( 'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | my @commands; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | while ( my $method = shift @$data ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | push @commands, $soap->struct( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 'item', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | $soap->element( string => 'methodName' => $method ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | $soap->struct( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 'methodArgs', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | $self->pack_method_arguments( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | soap => $soap, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | name => $method, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | arguments => shift @$data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | skip_session => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | my $commands = $soap->struct('commands', @commands); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | #$commands->setAttribute( 'SOAP-ENC:arrayType' => 'xsd:instance['. scalar(@commands) .']' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $commands->setAttribute( 'xsi:type' => 'SOAP-ENC:Array' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | return $soap->struct( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | pack_type($ns, 'jxAPIBatch'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | $soap->struct( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 'jxAPICommandSet', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | $soap->element( string => 'session' => $self->jx->session ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | $soap->element( int => 'stop_on_error' => 0 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | $commands, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | my $in = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my ($soap, @msgs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # XXX: refactor me into something more elegant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | require Net::Journyx::SOAP::Encoding; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | my $old = ref $soap; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | bless $soap, 'Net::Journyx::SOAP::Encoding'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | my $tree = $soap->dec(@msgs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | $rv = $soap->decSimplify($tree) if $tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | bless $soap, $old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | return $rv? $rv : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | return $self->client->compileClient( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | name => 'jxAPIBatch', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | rpcout => $out, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | rpcin => $in, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | encode => $self->encoder, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | decode => $self->decoder, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | transport => $self->batch_transport, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub jxapi_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
jxapi_type: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | my $schema = $self->schema; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my ($type_node) = $schema->findnodes('.//xsd:complexType[@name = "'.$type.'"]'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | die "couldn't find type '$type' in the schema" unless $type_node; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | my %res = (order => []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | my @elements = $type_node->findnodes('.//xsd:element'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | foreach my $el ( @elements ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | my $name = $el->getAttribute('name'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $el_type = $el->getAttribute('type'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | #warn "found element '$name' of type '$el_type' for jxapi $type"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | push @{ $res{'order'} }, $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $res{'type'}{$name} = $el_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | return \%res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | sub records { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
records: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $schema = $self->schema; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | my (@types) = $schema->findnodes('.//xsd:complexType'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | die "couldn't find types in the schema" unless @types; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | foreach my $t ( @types ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | next unless ($t->findnodes('.//xsd:extension[@base="typens:Record"]'))[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | push @res, $t->getAttribute('type'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | return @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | sub record_columns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
record_columns: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my $record = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | return %{ $self->jxapi_type( $record )->{'type'} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | sub encode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encode: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | for my $text (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | my $text = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | if (!ref($text) && !$self->jx->allows_utf8) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $text or $self->jx->allows_utf8
MC/DC0%0/2
ref $text or $self->jx->allows_utf8
ref $text
$self->jx->allows_utf8
Truth table0%0/3
A or B
A= ref $textB= $self->jx->allows_utf8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | $text = join '', map { ord($_) > 127 ? '?' : $_ } split '', $text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | push @ret, $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | return @ret if wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | return $ret[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | sub pack_method_arguments { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pack_method_arguments: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my %args = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | soap => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | name => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | arguments => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | skip_session => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | @_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | my $api = $self->API->{$args{'name'}} or die "no operation '$args{'name'}'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | my $ns = $self->namespace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | foreach my $arg ( @{ $api->{'order'} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | my $type = $api->{'input_type'}{ $arg }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $value = delete $args{'arguments'}{ $arg }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | if ( $arg =~ /^s(?:ession_)?key$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | next if $args{'skip_session'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | $value = $self->jx->session | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my ($type_ns, $type_name) = split(/:/, $type, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | if ( $type_ns eq 'xsd' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | #warn "building '$value' as argument $arg (type: $type) for operation $args{'name'}"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $value = $self->encode($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | push @elements, $args{'soap'}->element( $type_name => $arg => $value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } elsif ( $type_ns eq 'typens' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | # XXX: here we want autorecords from our Record objects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | ▶ | die "$args{'name'}'s argument is of complex type '$type_name', pass hash reference" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | unless ref($value) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | push @elements, $self->pack_complex_type( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | argument => pack_type($ns, $arg), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | value => $value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | meta => $self->jxapi_type( $type_name ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | soap => $args{'soap'}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | die "XXX: can not handle"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | return @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | sub pack_complex_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pack_complex_type: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my %args = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | argument => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | value => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | meta => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | soap => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | @_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | my ($meta, $soap) = @args{'meta', 'soap'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | foreach my $arg ( @{ $meta->{'order'} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | my $type = $meta->{'type'}{$arg}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | unless ( exists $args{'value'}{ $arg } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | #warn "argument '$arg' is not provided, skipping"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my ($type_ns, $type_name) = split(/:/, $type, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | if ( $type_ns eq 'xsd' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | my $value = $self->encode($args{value}{$arg}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | push @elements, $soap->element( $type_name => $arg => $value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | } elsif ( $type_ns eq 'typens' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | die "recursive complex schema types are not supported"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | die "XXX: can not handle name space $type_ns"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | return $soap->struct($args{'argument'}, @elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | sub _create_call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_create_call: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | my ($name, $out, $in ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | return $self->client->compileClient( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | rpcout => $out, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | rpcin => $in, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | encode => $self->encoder, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | decode => $self->decoder, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | transport => $self->transport, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 250 | ▶ | sub nocapitals { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nocapitals: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 250 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 250 | my $res = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 250 | $res =~ s/(?<=[a-z])([A-Z]+)/"_" . lc($1)/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 250 | $res =~ tr/A-Z/a-z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 250 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 10 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 10 | ▶ | no Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||