/[cwmp]/google/lib/CWMP/Response.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /google/lib/CWMP/Response.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 31 by dpavlin, Mon Jun 18 20:07:17 2007 UTC revision 38 by dpavlin, Tue Jun 19 09:43:57 2007 UTC
# Line 3  package CWMP::Response; Line 3  package CWMP::Response;
3  use strict;  use strict;
4  use warnings;  use warnings;
5    
6    use base qw/Class::Accessor/;
7    __PACKAGE__->add_accessor( qw/
8    debug
9    /);
10    
11  use XML::Generator;  use XML::Generator;
12    use Carp qw/confess/;
13    use Data::Dump qw/dump/;
14    
15    =head1 NAME
16    
17    CWMP::Response - generate SOAP meesage for response
18    
19    =head2 METHODS
20    
21    =head2 new
22    
23      my $response = CWMP::Response->new({ debug => 1 });
24    
25    =cut
26    
27    sub new {
28            my $class = shift;
29            my $self = $class->SUPER::new( @_ );
30    
31  my $X = XML::Generator->new(':pretty');          warn "created XML::Generator object" if $self->debug;
32    
33            return $self;
34    }
35    
 my $ns = [  
     encodingStyle => "http://schemas.xmlsoap.org/soap/encoding/",  
 ];  
36    
37  my $cwmp = [ cwmp => 'urn:dslforum-org:cwmp-1-0' ];  my $cwmp = [ cwmp => 'urn:dslforum-org:cwmp-1-0' ];
38  my $soap = [ soap => "http://schemas.xmlsoap.org/soap/envelope/" ];  my $soap = [ soap => "http://schemas.xmlsoap.org/soap/envelope/" ];
39    
40  print $X->Envelope( $soap, { 'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" },  =head2 Inform
41          $X->Header( $soap,  
42                  $X->ID( $cwmp, { mustUnderstand => 1 }, 1234 ),    $response->Inform( $state );
43          ),  
44          $X->Body( $soap,  =cut
45                  $X->InformResponse( $cwmp,  
46                          $X->MaxEnvelopes( $cwmp, 1 )  sub Inform {
47                  )          my $self = shift;
48          ),  
49  );          my $state = shift or confess "no state?";
50    
51            confess "no ID in state ", dump( $state ) unless ( $state->{ID} );
52    
53            my $X = XML::Generator->new(':pretty');
54    
55            return $X->Envelope( $soap, { 'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" },
56                    $X->Header( $soap,
57                            $X->ID( $cwmp, { mustUnderstand => 1 }, $state->{ID} ),
58                    ),
59                    $X->Body( $soap,
60                            $X->InformResponse( $cwmp,
61                                    $X->MaxEnvelopes( $cwmp, 1 )
62                            )
63                    ),
64            );
65    }
66    
67    1;

Legend:
Removed from v.31  
changed lines
  Added in v.38

  ViewVC Help
Powered by ViewVC 1.1.26