| 1 | #!/usr/bin/env perl | ||||||||||||||||||||||||||||
| 2 | # ---------------------------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 3 | # © Copyright 2003-2011 by Alex Peeters [alex.peeters@citap.be] | ||||||||||||||||||||||||||||
| 4 | # ---------------------------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 5 | # 2011/mm/dd, v3.002.003, check_template-SOAP.pl | ||||||||||||||||||||||||||||
| 6 | # ---------------------------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use warnings; # Must be used in test mode only. This reduces a little process speed | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | #use diagnostics; # Must be used in test mode only. This reduces a lot of process speed | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | BEGIN { if ( $ENV{ASNMTAP_PERL5LIB} ) { eval 'use lib ( "$ENV{ASNMTAP_PERL5LIB}" )'; } } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=9.2
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use ASNMTAP::Asnmtap::Plugins v3.002.003; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use ASNMTAP::Asnmtap::Plugins qw(:PLUGINS); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 3 | my $objectPlugins = ASNMTAP::Asnmtap::Plugins->new ( | |||||||||||||||||||||||||||
| 24 | _programName => 'check_template-SOAP.pl', | ||||||||||||||||||||||||||||
| 25 | _programDescription => "SOAP::LITE plugin template for testing the '$APPLICATION' with Performance Data", | ||||||||||||||||||||||||||||
| 26 | _programVersion => '3.002.003', | ||||||||||||||||||||||||||||
| 27 | _programGetOptions => ['proxy:s', 'timeout|t:i', 'trendline|T:i'], | ||||||||||||||||||||||||||||
| 28 | _timeout => 30, | ||||||||||||||||||||||||||||
| 29 | _debug => 0); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 3 | ▶ | use ASNMTAP::Asnmtap::Plugins::SOAP qw(&get_soap_request); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 3 | ▶ | use SOAP::Lite; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 1 | my $proxy = 'http://services.soaplite.com/hibye.cgi'; | |||||||||||||||||||||||||||
| 40 | 1 | my $namespace = 'http://www.soaplite.com/Demo'; | |||||||||||||||||||||||||||
| 41 | 1 | my $methodName = 'hi'; | |||||||||||||||||||||||||||
| 42 | 1 | my $method = SOAP::Data->name($methodName)->attr( {xmlns => $namespace} ); | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | my %soapService_Register_NS = ( | |||||||||||||||||||||||||||
| 45 | 'http://schemas.xmlsoap.org/wsdl/mime/' => 'mime', | ||||||||||||||||||||||||||||
| 46 | 'http://www.w3.org/2001/XMLSchema' => 's' | ||||||||||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 50 | # Start plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 51 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 1 | my ($returnCode, $xml); | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 1 | ($returnCode, $xml) = get_soap_request ( | |||||||||||||||||||||||||||
| 56 | asnmtapInherited => \$objectPlugins, | ||||||||||||||||||||||||||||
| 57 | custom => \&actionOnSoapResponse, | ||||||||||||||||||||||||||||
| 58 | customArguments => 'scalar', | ||||||||||||||||||||||||||||
| 59 | proxy => $proxy, | ||||||||||||||||||||||||||||
| 60 | namespace => $namespace, | ||||||||||||||||||||||||||||
| 61 | method => $method, | ||||||||||||||||||||||||||||
| 62 | registerNamespace => \%soapService_Register_NS, | ||||||||||||||||||||||||||||
| 63 | cookies => 1, | ||||||||||||||||||||||||||||
| 64 | perfdataLabel => 'SOAP' | ||||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 1 | ($returnCode, $xml) = get_soap_request ( | |||||||||||||||||||||||||||
| 68 | asnmtapInherited => \$objectPlugins, | ||||||||||||||||||||||||||||
| 69 | custom => \&actionOnSoapResponse, | ||||||||||||||||||||||||||||
| 70 | customArguments => [1, 2, 3], | ||||||||||||||||||||||||||||
| 71 | proxy => $proxy, | ||||||||||||||||||||||||||||
| 72 | namespace => $namespace, | ||||||||||||||||||||||||||||
| 73 | method => $method, | ||||||||||||||||||||||||||||
| 74 | registerNamespace => \%soapService_Register_NS, | ||||||||||||||||||||||||||||
| 75 | cookies => 1, | ||||||||||||||||||||||||||||
| 76 | perfdataLabel => 'SOAP' | ||||||||||||||||||||||||||||
| 77 | ); | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 1 | ($returnCode, $xml) = get_soap_request ( | |||||||||||||||||||||||||||
| 80 | asnmtapInherited => \$objectPlugins, | ||||||||||||||||||||||||||||
| 81 | custom => \&actionOnSoapResponse, | ||||||||||||||||||||||||||||
| 82 | customArguments => {a => 1, b => 2, c => 3}, | ||||||||||||||||||||||||||||
| 83 | proxy => $proxy, | ||||||||||||||||||||||||||||
| 84 | namespace => $namespace, | ||||||||||||||||||||||||||||
| 85 | method => $method, | ||||||||||||||||||||||||||||
| 86 | registerNamespace => \%soapService_Register_NS, | ||||||||||||||||||||||||||||
| 87 | cookies => 1, | ||||||||||||||||||||||||||||
| 88 | perfdataLabel => 'SOAP' | ||||||||||||||||||||||||||||
| 89 | ); | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 1 | ($returnCode, $xml) = get_soap_request ( | |||||||||||||||||||||||||||
| 92 | asnmtapInherited => \$objectPlugins, | ||||||||||||||||||||||||||||
| 93 | custom => \&actionOnSoapResponse, | ||||||||||||||||||||||||||||
| 94 | customArguments => \$proxy, | ||||||||||||||||||||||||||||
| 95 | proxy => $proxy, | ||||||||||||||||||||||||||||
| 96 | namespace => $namespace, | ||||||||||||||||||||||||||||
| 97 | method => $method, | ||||||||||||||||||||||||||||
| 98 | registerNamespace => \%soapService_Register_NS, | ||||||||||||||||||||||||||||
| 99 | cookies => 1, | ||||||||||||||||||||||||||||
| 100 | perfdataLabel => 'SOAP' | ||||||||||||||||||||||||||||
| 101 | ); | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 1 | ($returnCode, $xml) = get_soap_request ( | |||||||||||||||||||||||||||
| 104 | asnmtapInherited => \$objectPlugins, | ||||||||||||||||||||||||||||
| 105 | custom => \&actionOnSoapResponse, | ||||||||||||||||||||||||||||
| 106 | customArguments => \[1, 2, 3], | ||||||||||||||||||||||||||||
| 107 | proxy => $proxy, | ||||||||||||||||||||||||||||
| 108 | namespace => $namespace, | ||||||||||||||||||||||||||||
| 109 | method => $method, | ||||||||||||||||||||||||||||
| 110 | registerNamespace => \%soapService_Register_NS, | ||||||||||||||||||||||||||||
| 111 | cookies => 1, | ||||||||||||||||||||||||||||
| 112 | perfdataLabel => 'SOAP' | ||||||||||||||||||||||||||||
| 113 | ); | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 1 | ($returnCode, $xml) = get_soap_request ( | |||||||||||||||||||||||||||
| 116 | asnmtapInherited => \$objectPlugins, | ||||||||||||||||||||||||||||
| 117 | custom => \&actionOnSoapResponse, | ||||||||||||||||||||||||||||
| 118 | customArguments => \{a => 1, b => 2, c => 3}, | ||||||||||||||||||||||||||||
| 119 | proxy => $proxy, | ||||||||||||||||||||||||||||
| 120 | namespace => $namespace, | ||||||||||||||||||||||||||||
| 121 | method => $method, | ||||||||||||||||||||||||||||
| 122 | registerNamespace => \%soapService_Register_NS, | ||||||||||||||||||||||||||||
| 123 | cookies => 1, | ||||||||||||||||||||||||||||
| 124 | perfdataLabel => 'SOAP' | ||||||||||||||||||||||||||||
| 125 | ); | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 1 | ▶ | unless ( $returnCode ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 0 | ▶ | if (defined $xml) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | } else { | ||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 134 | # End plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 135 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 1 | $objectPlugins->exit (7); | |||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub actionOnSoapResponse { | ||||||||||||||||||||||||||
|
Subroutine
actionOnSoapResponse: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||
| 142 | 0 | my ($asnmtapInherited, $tSom, $arguments) = @_; | |||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | 0 | my $debug = $asnmtapInherited->getOptionsValue ('debug'); | |||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if ($debug and defined $arguments) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$debug and defined $arguments
MC/DC0%0/2
$debug and defined $arguments
$debug
defined $arguments
Truth table0%0/3
A and B
A= $debugB= defined $arguments
| |||||||||||||||||||||||||||||
| 147 | 0 | for ( ref $arguments ) { | |||||||||||||||||||||||||||
| 148 | /^REF$/ && | ||||||||||||||||||||||||||||
| 149 | 0 | ▶ | do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | 0 | for ( ref $$arguments ) { | |||||||||||||||||||||||||||
| 151 | /^ARRAY$/ && | ||||||||||||||||||||||||||||
| 152 | 0 | ▶ | do { print "REF ARRAY: @$$arguments\n"; last; }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 153 | /^HASH$/ && | ||||||||||||||||||||||||||||
| 154 | 0 | ▶ | do { print "REF HASH: "; while (my ($key, $value) = each %{ $$arguments } ) { print "$key => $value "; }; print "\n"; last; }; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 0 | last; | |||||||||||||||||||||||||||
| 158 | }; | ||||||||||||||||||||||||||||
| 159 | /^ARRAY$/ && | ||||||||||||||||||||||||||||
| 160 | 0 | ▶ | do { print "ARRAY: @$arguments\n"; last; }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | /^HASH$/ && | ||||||||||||||||||||||||||||
| 162 | 0 | ▶ | do { print "HASH: "; while (my ($key, $value) = each %{ $arguments } ) { print "$key => $value "; }; print "\n"; last; }; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 163 | /^SCALAR$/ && | ||||||||||||||||||||||||||||
| 164 | 0 | ▶ | do { print "REF SCALAR: ", $$arguments, "\n"; last; }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 0 | print "SCALAR: ", $arguments, "\n"; | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 0 | my $returnCode = $ERRORS{OK}; | |||||||||||||||||||||||||||
| 170 | 0 | $asnmtapInherited->pluginValues ( { stateValue => $returnCode, alert => 'SOAP::LITE' }, $TYPE{APPEND} ); | |||||||||||||||||||||||||||
| 171 | 0 | return ($returnCode); | |||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | __END__ | ||||||||||||||||||||||||||||