From 7c3a915b5a8f2c5d79d6657bd174d0f4a7e452ce Mon Sep 17 00:00:00 2001 From: Tomas Plesnik <plesnik@ics.muni.cz> Date: Wed, 21 Mar 2012 16:50:39 +0100 Subject: [PATCH] oprava chybneho vytahovani elementu ze SOAP objektu --- src/warden-server/lib/WardenStatus.pm | 39 ++++++++++++++------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/warden-server/lib/WardenStatus.pm b/src/warden-server/lib/WardenStatus.pm index 4eed30f..bf21970 100755 --- a/src/warden-server/lib/WardenStatus.pm +++ b/src/warden-server/lib/WardenStatus.pm @@ -36,7 +36,8 @@ package WardenStatus; use strict; use SOAP::Lite; use IO::Socket::SSL qw(debug1); -use SOAP::Transport::TCP +use SOAP::Transport::TCP; +use Data::Dumper; our $VERSION = "0.2"; @@ -112,11 +113,10 @@ sub getClients # call server method getClients my $response = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "getClients"); - my ($client_id, $hostname, $registered, $requestor, $service, $client_type, $type, $receive_own_events, $description_tags, $ip_net_client); - my @clients; - # parse returned SOAP data object - my @response_list = $response->valueof('/Envelope/Body/getClientsResponse/'); + my @clients; + my ($client_id, $hostname, $registered, $requestor, $service, $client_type, $type, $receive_own_events, $description_tags, $ip_net_client); + my @response_list = $response->valueof('/Envelope/Body/getClientsResponse/client'); while (scalar @response_list) { my $response_data = shift(@response_list); my @client; @@ -134,7 +134,7 @@ sub getClients $ip_net_client = $response_data->{'IP_NET_CLIENT'}; # push received clients from warden server into @clients which is returned - @client = ("$client_id", "$hostname", "$registered", "$requestor", "$service", "$client_type", "$type", "$receive_own_events", "$description_tags", "$ip_net_client"); + @client = ($client_id, $hostname, $registered, $requestor, $service, $client_type, $type, $receive_own_events, $description_tags, $ip_net_client); push (@clients,\@client); } return @clients; @@ -159,11 +159,11 @@ sub getStatus # call server method getStatus my $response = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "getStatus"); - # parse returned SOAP data object - my @response_list = $response->valueof('/Envelope/Body/getStatusResponse/'); + #----------------------------------------------------------------------------- + # parse server status + my @response_list = $response->valueof('/Envelope/Body/getStatusResponse/server_status'); my $response_data = shift(@response_list); - - # parse items of server status + my $version = $response_data->{'VERSION'}; my $address = $response_data->{'ADDRESS'}; my $port = $response_data->{'PORT'}; @@ -182,21 +182,24 @@ sub getStatus my $clients_sum = $response_data->{'CLIENTS_SUM'}; my @status; - my @server_status = ("$version", "$address", "$port", "$logdir", "$piddir", "$vardir", "$ssl_key_file_server", "$ssl_cert_file_server", "$ssl_ca_file_server", "$facility", "$db_size", "$events_sum", "$events_last_id", "$events_first_timestamp", "$events_last_timestamp", "$clients_sum"); + my @server_status = ($version, $address, $port, $logdir, $piddir, $vardir, $ssl_key_file_server, $ssl_cert_file_server, $ssl_ca_file_server, $facility, $db_size, $events_sum, $events_last_id, $events_first_timestamp, $events_last_timestamp, $clients_sum); push(@status, \@server_status); + #----------------------------------------------------------------------------- + # parse client status + my ($client_id, $hostname, $service, $count, $timestamp); + @response_list = $response->valueof('/Envelope/Body/getStatusResponse/client_status'); while (scalar @response_list) { my $response_data = shift(@response_list); my @client_status; - # parse item of client status - my $client_id = $response_data->{'CLIENT_ID'}; - my $hostname = $response_data->{'HOSTNAME'}; - my $service = $response_data->{'SERVICE'}; - my $count = $response_data->{'COUNT'}; - my $timestamp = $response_data->{'TIMESTAMP'}; + $client_id = $response_data->{'CLIENT_ID'}; + $hostname = $response_data->{'HOSTNAME'}; + $service = $response_data->{'SERVICE'}; + $count = $response_data->{'COUNT'}; + $timestamp = $response_data->{'TIMESTAMP'}; - @client_status = ("$client_id", "$hostname", "$service", "$count", "$timestamp"); + @client_status = ($client_id, $hostname, $service, $count, $timestamp); push(@status, \@client_status); } return @status; -- GitLab