ASNMTAP
view release on metacpan or search on metacpan
lib/ASNMTAP/Asnmtap/Plugins/SOAP.pm view on Meta::CPAN
-> encprefix ( $encprefix )
-> xmlschema ( 'http://www.w3.org/2001/XMLSchema' )
-> uri ( $namespace )
-> on_action ( sub { my $uri = $_[0]; $uri =~ s/\/$//; my $method = (defined $soapaction ? ( $soapaction eq '' ? '' : $soapaction ) : $uri .'/'. $_[1]) } )
-> on_fault ( sub { } )
;
} else {
if ( $debug >= 4 ) {
eval "use SOAP::Lite +trace => 'all'";
} elsif ($debug == 1) {
eval "use SOAP::Lite +trace => qw( debug )";
} else {
eval "use SOAP::Lite";
}
$service = new SOAP::Lite
-> autotype ( 1 )
-> readable ( $readable )
-> envprefix ( $envprefix )
-> encprefix ( $encprefix )
-> xmlschema ( 'http://www.w3.org/2001/XMLSchema' )
-> uri ( $namespace )
-> on_action ( sub { my $uri = $_[0]; $uri =~ s/\/$//; my $method = (defined $soapaction ? ( $soapaction eq '' ? '' : $soapaction ) : $uri .'/'. $_[1]) } )
-> on_fault ( sub { } )
;
}
$service->serializer->encodingStyle ( $encodingStyle ) if ( defined $encodingStyle );
$SOAP::Constants::PATCH_HTTP_KEEPALIVE = $PATCH_HTTP_KEEPALIVE;
if ( defined $parms{registerNamespace} ) {
while ( my ($key, $value) = each( %{ $parms{registerNamespace} } ) ) {
$service->serializer->register_ns($key, $value);
}
}
if ( defined $proxySettings ) {
$service->proxy ( $parms{proxy}, timeout => $timeout, proxy => ['http' => "http://$proxySettings"] );
} else {
$service->proxy ( $parms{proxy}, timeout => $timeout );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$service->transport->credentials( @{$parms{credentials}} ) if ( defined $parms{credentials} );
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# $service->proxy ( 'https://USERNAME:PASSWORD@secure.citap.be/authorization/hibye.cgi' );
# or
# $service->proxy ( 'https://secure.citap.be/authorization/hibye.cgi', credentials => [ 'secure.citap.be:443', "ASNMTAP's Authorization Access", 'USERNAME' => 'PASSWORD' ], timeout => $timeout );
# or
# $service->transport->credentials( 'secure.citap.be:443', "ASNMTAP's Authorization Access", 'USERNAME' => 'PASSWORD' );
# or
# use MIME::Base64;
# $service->transport->http_request->header( 'Authorization' => 'Basic '. MIME::Base64::encode ( 'USERNAME' .':'. 'PASSWORD', '' ) );
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$service->transport->agent( $browseragent );
$service->transport->timeout( $timeout );
use HTTP::Cookies;
$service->transport->cookie_jar( HTTP::Cookies->new ) if ( $cookies );
$service->transport->default_headers->push_header( 'Accept-Language' => "no, en" );
$service->transport->default_headers->push_header( 'Accept-Charset' => "iso-8859-1,*,utf-8" );
$service->transport->default_headers->push_header( 'Accept-Encoding' => "gzip, deflate" );
print "ASNMTAP::Asnmtap::Plugins::SOAP::get_soap_request: () -->\n" if ( $debug );
$$asnmtapInherited->setEndTime_and_getResponsTime ( $$asnmtapInherited->pluginValue ('endTime') );
my $som = (defined $params and $params ne '') ? (ref $params eq 'ARRAY' ? $service->call( $parms{method} => @$params ) : $service->call( $parms{method} => $params )) : $service->call( $parms{method} );
my $responseTime = $$asnmtapInherited->setEndTime_and_getResponsTime ( $$asnmtapInherited->pluginValue ('endTime') );
$$asnmtapInherited->appendPerformanceData ( "'". $parms{perfdataLabel} ."'=". $responseTime ."ms;;;;" );
print "ASNMTAP::Asnmtap::Plugins::SOAP::get_soap_request: () <->\n" if ( $debug );
my $returnCode = _soapCheckTransportStatus ($asnmtapInherited, $service, $TYPE_ERROR_RETURN, $debug);
unless ( $returnCode ) {
unless ( defined $som and defined $som->fault ) {
$result = UNIVERSAL::isa($som => ($WSRF ? 'WSRF::SOM' : 'SOAP::SOM')) ? (wantarray ? $som->paramsall : $som->result) : $som;
if ( $debug ) {
for ( ref $result ) {
/^REF$/ &&
do {
for ( ref $$result ) {
/^ARRAY$/ &&
do { print "ASNMTAP::Asnmtap::Plugins::SOAP::get_soap_request: REF ARRAY: @$$result\n"; last; };
/^HASH$/ &&
do { print "ASNMTAP::Asnmtap::Plugins::SOAP::get_soap_request: REF HASH: "; while (my ($key, $value) = each %{ $$result } ) { print "$key => $value "; }; print "\n"; last; };
}
last;
};
/^ARRAY$/ &&
do { print "ASNMTAP::Asnmtap::Plugins::SOAP::get_soap_request: ARRAY: @$result\n"; last; };
/^HASH$/ &&
do { print "ASNMTAP::Asnmtap::Plugins::SOAP::get_soap_request: HASH: "; while (my ($key, $value) = each %{ $result } ) { print "$key => $value "; }; print "\n"; last; };
/^SCALAR$/ &&
do { print "ASNMTAP::Asnmtap::Plugins::SOAP::get_soap_request: REF SCALAR: ", $$result, "\n"; last; };
print "ASNMTAP::Asnmtap::Plugins::SOAP::get_soap_request: SCALAR: ", $result, "\n";
}
}
if ( $returnCode == $ERRORS{OK} and defined $parms{custom} ) {
my $root = $som->dataof ('/Envelope/Body');
if ( defined $root ) {
$returnCode = ( defined $parms{customArguments} ) ? $parms{custom}->($$asnmtapInherited, $som, $parms{customArguments}) : $parms{custom}->($$asnmtapInherited, $som);
} else {
print "ASNMTAP::Asnmtap::Plugins::SOAP::get_soap_request: Missing SOAP Envelope or Body", "\n" if ( $debug );
$$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing SOAP Envelope or Body' }, $TYPE{APPEND} );
return ($returnCode, undef);
}
}
} else {
$returnCode = _soapCheckFault ($asnmtapInherited, $som, $debug);
}
} else {
$returnCode = _soapCheckFault ($asnmtapInherited, $som, $debug) if ( defined $som and defined $som->fault );
}
( run in 0.502 second using v1.01-cache-2.11-cpan-39bf76dae61 )