/[cwmp]/google/trunk/lib/CWMP/Methods.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/trunk/lib/CWMP/Methods.pm

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

revision 32 by dpavlin, Mon Jun 18 23:52:41 2007 UTC revision 46 by dpavlin, Tue Jun 19 19:50:29 2007 UTC
# Line 3  package CWMP::Response; Line 3  package CWMP::Response;
3  use strict;  use strict;
4  use warnings;  use warnings;
5    
 use XML::Generator;  
6  use base qw/Class::Accessor/;  use base qw/Class::Accessor/;
7  __PACKAGE__->add_accessor( qw/  __PACKAGE__->add_accessor( qw/
8  debug  debug
9  /);  /);
10    
11    use XML::Generator;
12    use Carp qw/confess/;
13    use Data::Dump qw/dump/;
14    
15  =head1 NAME  =head1 NAME
16    
17  CWMP::Response - generate SOAP meesage for response  CWMP::Response - generate SOAP meesage for response
# Line 36  my $soap = [ soap => "http://schemas.xml Line 39  my $soap = [ soap => "http://schemas.xml
39    
40  =head2 Inform  =head2 Inform
41    
42    $response->Inform;    $response->Inform( $state );
43    
44  =cut  =cut
45    
46  sub Inform {  sub Inform {
47            my ( $self, $state ) = @_;
48            $self->xml( $state, sub {
49                    my ( $X, $state ) = @_;
50                    $X->InformResponse( $cwmp,
51                            $X->MaxEnvelopes( $cwmp, 1 )
52                    );
53            });
54    }
55    
56    =head2 GetRPCMethods
57    
58      $response->GetRPCMethods( $state );
59    
60    =cut
61    
62    sub GetRPCMethods {
63            my ( $self, $state ) = @_;
64            $self->xml( $state, sub {
65                    my ( $X, $state ) = @_;
66                    $X->GetRPCMethods();
67            });
68    };
69    
70    sub xml {
71          my $self = shift;          my $self = shift;
72    
73            my ( $state, $closure ) = @_;
74    
75            confess "no state?" unless ($state);
76            confess "no body closure" unless ( $closure );
77    
78            confess "no ID in state ", dump( $state ) unless ( $state->{ID} );
79    
80          my $X = XML::Generator->new(':pretty');          my $X = XML::Generator->new(':pretty');
81    
82          return $X->Envelope( $soap, { 'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" },          return $X->Envelope( $soap, { 'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" },
83                  $X->Header( $soap,                  $X->Header( $soap,
84                          $X->ID( $cwmp, { mustUnderstand => 1 }, 1234 ),                          $X->ID( $cwmp, { mustUnderstand => 1 }, $state->{ID} ),
                 ),  
                 $X->Body( $soap,  
                         $X->InformResponse( $cwmp,  
                                 $X->MaxEnvelopes( $cwmp, 1 )  
                         )  
85                  ),                  ),
86                    $X->Body( $soap, $closure->( $X, $state ) ),
87          );          );
88  }  }
89    

Legend:
Removed from v.32  
changed lines
  Added in v.46

  ViewVC Help
Powered by ViewVC 1.1.26