| 1 | # Copyrights 2007-2022 by [Mark Overmeer <markov@cpan.org>]. | ||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.03. | ||||||||||||||||||||
| 5 | # This code is part of distribution XML-Compile-SOAP. Meta-POD processed | ||||||||||||||||||||
| 6 | # with OODoc into POD and HTML manual-pages. See README.md | ||||||||||||||||||||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | package XML::Compile::SOAP::Operation; | ||||||||||||||||||||
| 10 | 7 | ▶ | use vars '$VERSION'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 7 | $VERSION = '3.28'; | |||||||||||||||||||
| 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-report-soap'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 7 | ▶ | use XML::Compile::Util qw/pack_type unpack_type/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | 7 | ▶ | use XML::Compile::SOAP::Util qw/:wsdl11/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 7 | ▶ | use File::Spec (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 23 | 7 | ▶ | use List::Util qw(first); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | 7 | ▶ | use File::Basename qw(dirname); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 7 | my %servers = | |||||||||||||||||||
| 27 | ( 'XML::Compile::Daemon' => # my own server implementation | ||||||||||||||||||||
| 28 | { xsddir => 'xcdaemon' | ||||||||||||||||||||
| 29 | , xsds => [ qw(xcdaemon.xsd) ] | ||||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | # more in XML::Compile::Licensed | ||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 0 | ▶ | sub new(@) { my $class = shift; (bless {}, $class)->init( {@_} ) } | ||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | sub init($) | ||||||||||||||||||||
| 38 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||
|
Subroutine
init: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||
| 39 | 0 | ▶ | $self->{kind} = $args->{kind} or panic; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 40 | 0 | ▶ | $self->{name} = $args->{name} or panic; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 41 | 0 | ▶ | $self->{schemas} = $args->{schemas} or panic; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 42 | 0 | $self->_server_type($args->{server_type}); | |||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 0 | $self->{transport} = $args->{transport}; | |||||||||||||||||||
| 45 | 0 | $self->{action} = $args->{action}; | |||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 0 | ▶ | my $ep = $args->{endpoints} || []; | ||||||||||||||||||
|
Condition0%0/2
$args->{'endpoints'} || []
MC/DC0%0/1
$args->{'endpoints'} || []
$args->{'endpoints'}
Truth table0%0/2
A
A= $args->{'endpoints'}
| |||||||||||||||||||||
| 48 | 0 | ▶ | my @ep = ref $ep eq 'ARRAY' ? @$ep : $ep; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 49 | 0 | $self->{endpoints} = \@ep; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | # undocumented, because not for end-user | ||||||||||||||||||||
| 52 | 0 | ▶ | if(my $binding = $args->{binding}) { $self->{bindname} = $binding->{name} } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 53 | 0 | ▶ | if(my $service = $args->{service}) { $self->{servname} = $service->{name} } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 54 | 0 | ▶ | if(my $port = $args->{serv_port}){ $self->{portname} = $port->{name} } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 55 | 0 | ▶ | if(my $port_type= $args->{portType}){ $self->{porttypename} = $port_type->{name} } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 0 | $self; | |||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | sub registered | ||||||||||||||||||||
| 61 | 0 | ▶ | { # This cannot be resolved via dependencies, because that causes | ||||||||||||||||||
|
Subroutine
registered: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 62 | # a dependency cycle which CPAN.pm cannot handle. This method was | ||||||||||||||||||||
| 63 | # always called in <3.00 and moved to ::SOAP in >= 3.00 | ||||||||||||||||||||
| 64 | 0 | error "You need to upgrade XML::Compile::WSDL11 to at least 3.00"; | |||||||||||||||||||
| 65 | } | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | sub _server_type($) | ||||||||||||||||||||
| 68 | 0 | ▶ | { my ($self, $type) = @_; | ||||||||||||||||||
|
Subroutine
_server_type: not called CC=7 SCAR=40.3
| |||||||||||||||||||||
| 69 | 0 | ▶ | $type or return; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 0 | my $schemas = $self->schemas; | |||||||||||||||||||
| 72 | 0 | ▶ | return if $schemas->{"did_init_server_$type"}++; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | 0 | my ($def, $xsddir); | |||||||||||||||||||
| 75 | 0 | ▶ | if($def = $servers{$type}) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 76 | 0 | { $xsddir = File::Spec->catdir(dirname(__FILE__), 'xsd', $def->{xsddir}); | |||||||||||||||||||
| 77 | } | ||||||||||||||||||||
| 78 | else | ||||||||||||||||||||
| 79 | 0 | { eval "require XML::Compile::Licensed"; | |||||||||||||||||||
| 80 | 0 | ▶ | if($@) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 81 | 0 | { error __x"soap server type `{type}' is not supported (yet); installing XML::Compile::Licensed may help" | |||||||||||||||||||
| 82 | , type => $type; | ||||||||||||||||||||
| 83 | } | ||||||||||||||||||||
| 84 | 0 | ▶ | ($xsddir, $def) = XML::Compile::Licensed->soapServer($type) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 85 | or error __x"soap server type `{type}' is not supported (yet)" | ||||||||||||||||||||
| 86 | , type => $type; | ||||||||||||||||||||
| 87 | } | ||||||||||||||||||||
| 88 | |||||||||||||||||||||
| 89 | $schemas->importDefinitions(File::Spec->catfile($xsddir, $_)) | ||||||||||||||||||||
| 90 | 0 | for @{$def->{xsds}}; | |||||||||||||||||||
| 91 | } | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | #---------------- | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 0 | ▶ | sub schemas() {shift->{schemas}} | ||||||||||||||||||
|
Subroutine
schemas: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 96 | 0 | ▶ | sub kind() {shift->{kind}} | ||||||||||||||||||
|
Subroutine
kind: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 97 | 0 | ▶ | sub name() {shift->{name}} | ||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 98 | 0 | ▶ | sub style() {shift->{style}} | ||||||||||||||||||
|
Subroutine
style: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 99 | 0 | ▶ | sub transport() {shift->{transport}} | ||||||||||||||||||
|
Subroutine
transport: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 100 | 0 | ▶ | sub version() {panic} | ||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | 0 | ▶ | sub bindingName() {shift->{bindname}} | ||||||||||||||||||
|
Subroutine
bindingName: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 103 | 0 | ▶ | sub serviceName() {shift->{servname}} | ||||||||||||||||||
|
Subroutine
serviceName: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 104 | 0 | ▶ | sub portName() {shift->{portname}} | ||||||||||||||||||
|
Subroutine
portName: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 105 | 0 | ▶ | sub portTypeName(){shift->{porttypename}} | ||||||||||||||||||
|
Subroutine
portTypeName: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | 0 | ▶ | sub soapAction {shift->{action}} | ||||||||||||||||||
|
Subroutine
soapAction: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 109 | 0 | ▶ | sub action() {shift->{action}} # deprecated | ||||||||||||||||||
|
Subroutine
action: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | # wsaAction is implement in XML::Compile::SOAP::WSA | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | 0 | ▶ | sub serverClass {panic} | ||||||||||||||||||
|
Subroutine
serverClass: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 115 | 0 | ▶ | sub clientClass {panic} | ||||||||||||||||||
|
Subroutine
clientClass: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | 0 | ▶ | sub endPoints() { @{shift->{endpoints}} } | ||||||||||||||||||
|
Subroutine
endPoints: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | sub longName() | ||||||||||||||||||||
| 122 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||
|
Subroutine
longName: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 123 | 0 | ▶ | ($self->serviceName // '') . '#' . $self->name; | ||||||||||||||||||
|
Condition0%0/2
$self->serviceName // ""
MC/DC0%0/1
$self->serviceName // ""
$self->serviceName
Truth table0%0/2
A
A= $self->serviceName
| |||||||||||||||||||||
| 124 | } | ||||||||||||||||||||
| 125 | |||||||||||||||||||||
| 126 | #------------------------------------------- | ||||||||||||||||||||
| 127 | |||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | sub compileTransporter(@) | ||||||||||||||||||||
| 130 | 0 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||
|
Subroutine
compileTransporter: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||
| 131 | |||||||||||||||||||||
| 132 | 0 | ▶ | my $transp = delete $args{transporter} || delete $args{transport}; | ||||||||||||||||||
|
Condition0%0/3
delete $args{'transporter'} || delete $args{'transport'}
MC/DC0%0/2
delete $args{'transporter'} || delete $args{'transport'}
delete $args{'transporter'}
delete $args{'transport'}
Truth table0%0/3
A || B
A= delete $args{'transporter'}B= delete $args{'transport'}
| |||||||||||||||||||||
| 133 | 0 | ▶ | return $transp if ref $transp eq 'CODE'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | 0 | my $proto = $self->transport; | |||||||||||||||||||
| 136 | 0 | my @endpoints; | |||||||||||||||||||
| 137 | 0 | ▶ | if(my $endpoints = $args{endpoint}) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 138 | 0 | ▶ | { @endpoints = ref $endpoints eq 'ARRAY' ? @$endpoints : $endpoints; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 139 | } | ||||||||||||||||||||
| 140 | 0 | ▶ | unless(@endpoints) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 141 | 0 | { @endpoints = $self->endPoints; | |||||||||||||||||||
| 142 | 0 | ▶ | if(my $s = $args{server}) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 143 | 0 | { s#^(\w+)://([^/]+)#$1://$s# for @endpoints; | |||||||||||||||||||
| 144 | } | ||||||||||||||||||||
| 145 | } | ||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | 0 | my $id = join ';', sort @endpoints; | |||||||||||||||||||
| 148 | 0 | my $send = $self->{transp_cache}{$proto}{$id}; | |||||||||||||||||||
| 149 | 0 | ▶ | return $send if $send; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | 0 | ▶ | unless($transp) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 152 | 0 | ▶ | { my $type = XML::Compile::Transport->plugin($proto) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 153 | or error __x"transporter type {proto} not supported (add 'use {pkg}'?)" | ||||||||||||||||||||
| 154 | , proto => $proto, pkg => 'XML::Compile::Transport::SOAPHTTP'; | ||||||||||||||||||||
| 155 | 0 | $transp = $type->new(address => \@endpoints, %args); | |||||||||||||||||||
| 156 | } | ||||||||||||||||||||
| 157 | |||||||||||||||||||||
| 158 | 0 | my $transport = $self->{transp_cache}{$proto}{$id} = $transp; | |||||||||||||||||||
| 159 | |||||||||||||||||||||
| 160 | $transport->compileClient | ||||||||||||||||||||
| 161 | ( name => $self->name | ||||||||||||||||||||
| 162 | , kind => $self->kind | ||||||||||||||||||||
| 163 | , action => $self->action | ||||||||||||||||||||
| 164 | , hook => $args{transport_hook} | ||||||||||||||||||||
| 165 | 0 | , %args | |||||||||||||||||||
| 166 | ); | ||||||||||||||||||||
| 167 | } | ||||||||||||||||||||
| 168 | |||||||||||||||||||||
| 169 | |||||||||||||||||||||
| 170 | 0 | ▶ | sub compileClient(@) { panic "not implemented" } | ||||||||||||||||||
|
Subroutine
compileClient: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 171 | 0 | ▶ | sub compileHandler(@) { panic "not implemented" } | ||||||||||||||||||
|
Subroutine
compileHandler: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 172 | |||||||||||||||||||||
| 173 | #--------------- | ||||||||||||||||||||
| 174 | |||||||||||||||||||||
| 175 | sub explain($$$@) | ||||||||||||||||||||
| 176 | 0 | ▶ | { my ($self, $wsdl, $format, $dir, %args) = @_; | ||||||||||||||||||
|
Subroutine
explain: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 177 | 0 | panic "not implemented for ".ref $self; | |||||||||||||||||||
| 178 | } | ||||||||||||||||||||
| 179 | |||||||||||||||||||||
| 180 | |||||||||||||||||||||
| 181 | sub parsedWSDL(%) | ||||||||||||||||||||
| 182 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||
|
Subroutine
parsedWSDL: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 183 | 0 | panic "not implemented for ".ref $self; | |||||||||||||||||||
| 184 | } | ||||||||||||||||||||
| 185 | |||||||||||||||||||||
| 186 | 7 | 1; | |||||||||||||||||||