if soap version is specified for probe, don't do both versions

This commit is contained in:
Isaac Connor 2016-10-04 09:51:20 -04:00
parent de22f21813
commit e6626cef69
1 changed files with 51 additions and 44 deletions

View File

@ -41,6 +41,7 @@ require WSDiscovery::TransportUDP;
# Globals
my $verbose = 0;
my $soap_version = undef;
my $client;
# =========================================================================
@ -172,6 +173,8 @@ sub discover
my $uuid_gen = Data::UUID->new();
if ( ( ! $soap_version ) or ( $soap_version eq '1.1' ) ) {
if($verbose) {
print "Probing for SOAP 1.1\n"
}
@ -197,7 +200,9 @@ sub discover
interpret_messages($svc_discover, \%services, @responses);
@responses = ();
} # end if doing soap 1.1
if ( ( ! $soap_version ) or ( $soap_version eq '1.2' ) ) {
if($verbose) {
print "Probing for SOAP 1.2\n"
}
@ -206,11 +211,11 @@ sub discover
});
$svc_discover->set_soap_version('1.2');
# copies of the same Probe message must have the same MessageID.
# This is not a copy. So we generate a new uuid.
# copies of the same Probe message must have the same MessageID.
# This is not a copy. So we generate a new uuid.
$uuid = $uuid_gen->create_str();
# Everyone else, like the nodejs onvif code and odm only ask for NetworkVideoTransmitter
# Everyone else, like the nodejs onvif code and odm only ask for NetworkVideoTransmitter
$result = $svc_discover->ProbeOp(
{ # WSDiscovery::Types::ProbeType
xmlattr => { 'xmlns:dn' => 'http://www.onvif.org/ver10/network/wsdl', },
@ -224,6 +229,7 @@ sub discover
})
);
# print $result . "\n";
} # end if doing soap 1.2
interpret_messages($svc_discover, \%services, @responses);
}
@ -321,7 +327,7 @@ my $OPTIONS = "v";
sub HELP_MESSAGE
{
my ($fh, $pkg, $ver, $opts) = @_;
print $fh "Usage: " . __FILE__ . " [-v] probe \n";
print $fh "Usage: " . __FILE__ . " [-v] probe <soap version>\n";
print $fh " " . __FILE__ . " [-v] <command> <device URI> <soap version> <user> <password>\n";
print $fh <<EOF
Commands are:
@ -359,12 +365,13 @@ if(!defined $action) {
}
if($action eq "probe") {
$soap_version = shift;
discover();
}
else {
# all other actions need URI and credentials
my $url_svc_device = shift;
my $soap_version = shift;
$soap_version = shift;
my $username = shift;
my $password = shift;