diff --git a/src/warden-client/lib/WardenClientReceive.pm b/src/warden-client/lib/WardenClientReceive.pm index 8eae88f14d9a968c6653b28edd66edc04dc000b8..9024fb0eb757402f7a20486967a81eea2f7eb906 100755 --- a/src/warden-client/lib/WardenClientReceive.pm +++ b/src/warden-client/lib/WardenClientReceive.pm @@ -39,7 +39,7 @@ use IO::Socket::SSL qw(debug1); use SOAP::Transport::TCP; use FindBin; -our $VERSION = "1.1"; +our $VERSION = "1.2"; #------------------------------------------------------------------------------- # errMsg - print error message and die @@ -145,20 +145,18 @@ sub getNewEvents # create SOAP data obejct my $request_data = SOAP::Data->name(request => \SOAP::Data->value( - SOAP::Data->name(REQUESTED_TYPE => $requested_type), - SOAP::Data->name(LAST_ID => $last_id) + SOAP::Data->name(REQUESTED_TYPE => $requested_type), + SOAP::Data->name(LAST_ID => $last_id) )); my $response = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "getNewEvents", $request_data); - # match getNewEvents functions response - $response->match('/Envelope/Body/getNewEventsResponse/'); my ($id, $hostname, $service, $detected, $type, $source_type, $source, $target_proto, $target_port, $attack_scale, $note, $priority, $timeout); my @events; # parse returned SOAP data object - my $i = 1; - my $response_data = $response->valueof("[$i]"); - while (defined $response_data) { + my @response_list = $response->valueof('/Envelope/Body/getNewEventsResponse/event/'); + while (scalar @response_list) { + my $response_data = shift(@response_list); my @event; # parse items of one event @@ -182,12 +180,8 @@ sub getNewEvents # set maximum received ID from current batch if ($id > $last_id) { - $last_id = $id; + $last_id = $id; } - - # go to the next received event - $i++; - $response_data = $response->valueof("[$i]"); } # write last return ID