source: ocsinventory-agent/trunk/fuentes/lib/Ocsinventory/Agent/XML/SimpleMessage.pm @ 468

Last change on this file since 468 was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

File size: 963 bytes
Line 
1package Ocsinventory::Agent::XML::SimpleMessage;
2
3use strict;
4use warnings;
5
6use Data::Dumper; # XXX Debug
7use XML::Simple;
8use Digest::MD5 qw(md5_base64);
9
10use Ocsinventory::Agent::XML::Prolog;
11
12sub new {
13  my (undef, $params) = @_;
14
15  my $self = {};
16  $self->{config} = $params->{config};
17  $self->{accountinfo} = $params->{accountinfo};
18 
19  die unless ($self->{config}->{deviceid}); #XXX
20
21  $self->{xmlroot}{QUERY} = ['PROLOG']; 
22  $self->{xmlroot}{DEVICEID} = [$self->{config}->{deviceid}];
23
24  bless $self;
25}
26
27sub dump {
28  my $self = shift;
29  print Dumper($self->{xmlroot});
30
31}
32
33sub set {
34  my ($self, $args) = @_;
35
36  foreach (keys %$args) {
37      $self->{xmlroot}{$_} = [$args->{$_}]; 
38  }
39}
40
41sub getContent {
42  my ($self, $args) = @_;
43
44  $self->{accountinfo}->setAccountInfo($self);
45  my $content=XMLout( $self->{xmlroot}, RootName => 'REQUEST', XMLDecl => '<?xml version="1.0" encoding="UTF-8"?>',
46    SuppressEmpty => undef );
47
48  return $content;
49}
50
51
52
531;
Note: See TracBrowser for help on using the repository browser.