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 # Globals
my $verbose = 0; my $verbose = 0;
my $soap_version = undef;
my $client; my $client;
# ========================================================================= # =========================================================================
@ -172,6 +173,8 @@ sub discover
my $uuid_gen = Data::UUID->new(); my $uuid_gen = Data::UUID->new();
if ( ( ! $soap_version ) or ( $soap_version eq '1.1' ) ) {
if($verbose) { if($verbose) {
print "Probing for SOAP 1.1\n" print "Probing for SOAP 1.1\n"
} }
@ -197,7 +200,9 @@ sub discover
interpret_messages($svc_discover, \%services, @responses); interpret_messages($svc_discover, \%services, @responses);
@responses = (); @responses = ();
} # end if doing soap 1.1
if ( ( ! $soap_version ) or ( $soap_version eq '1.2' ) ) {
if($verbose) { if($verbose) {
print "Probing for SOAP 1.2\n" print "Probing for SOAP 1.2\n"
} }
@ -224,6 +229,7 @@ sub discover
}) })
); );
# print $result . "\n"; # print $result . "\n";
} # end if doing soap 1.2
interpret_messages($svc_discover, \%services, @responses); interpret_messages($svc_discover, \%services, @responses);
} }
@ -321,7 +327,7 @@ my $OPTIONS = "v";
sub HELP_MESSAGE sub HELP_MESSAGE
{ {
my ($fh, $pkg, $ver, $opts) = @_; 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 " " . __FILE__ . " [-v] <command> <device URI> <soap version> <user> <password>\n";
print $fh <<EOF print $fh <<EOF
Commands are: Commands are:
@ -359,12 +365,13 @@ if(!defined $action) {
} }
if($action eq "probe") { if($action eq "probe") {
$soap_version = shift;
discover(); discover();
} }
else { else {
# all other actions need URI and credentials # all other actions need URI and credentials
my $url_svc_device = shift; my $url_svc_device = shift;
my $soap_version = shift; $soap_version = shift;
my $username = shift; my $username = shift;
my $password = shift; my $password = shift;