7 use base qw/Class::Accessor/;
8 __PACKAGE__->mk_accessors( qw/debug/ );
12 use Data::Dump qw/dump/;
16 CWMP::Methods - generate SOAP meesages for CPE
22 my $method = CWMP::Methods->new({ debug => 1 });
28 my $self = $class->SUPER::new( @_ );
30 warn "created XML::Generator object\n" if $self->debug;
37 Used to implement methods which modify just body of soap message.
38 For examples, see source of this module.
42 my $cwmp = [ cwmp => 'urn:dslforum-org:cwmp-1-0' ];
43 my $soap = [ soap => 'http://schemas.xmlsoap.org/soap/envelope/' ];
44 my $xsd = [ xsd => 'http://www.w3.org/2001/XMLSchema-instance' ];
49 my ( $state, $closure ) = @_;
51 confess "no state?" unless ($state);
52 confess "no body closure" unless ( $closure );
54 confess "no ID in state ", dump( $state ) unless ( $state->{ID} );
56 #warn "state used to generate xml = ", dump( $state ) if $self->debug;
58 my $X = XML::Generator->new(':pretty');
60 return $X->Envelope( $soap, { 'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" },
62 $X->ID( $cwmp, { mustUnderstand => 1 }, $state->{ID} ),
63 $X->NoMoreRequests( $cwmp, $state->{NoMoreRequests} || 0 ),
65 $X->Body( $soap, $closure->( $X, $state ) ),
73 $method->GetRPCMethods( $state );
78 my ( $self, $state ) = @_;
79 $self->xml( $state, sub {
80 my ( $X, $state ) = @_;
85 =head2 SetParameterValues
89 =head2 GetParameterValues
91 $method->GetParameterValues( $state, $ParameterNames );
95 sub GetParameterValues {
98 my @ParameterNames = @_;
99 confess "need ParameterNames" unless @ParameterNames;
100 warn "# GetParameterValues", dump( @ParameterNames ), "\n" if $self->debug;
102 $self->xml( $state, sub {
103 my ( $X, $state ) = @_;
105 $X->GetParameterValues( $cwmp,
106 $X->ParameterNames( $cwmp,
108 $X->string( $xsd, $_ )
115 =head2 GetParameterNames
117 $method->GetParameterNames( $state, $ParameterPath, $NextLevel );
121 sub GetParameterNames {
122 my ( $self, $state, $ParameterPath, $NextLevel ) = @_;
123 $ParameterPath ||= ''; # all
124 $NextLevel ||= 0; # all
125 warn "# GetParameterNames( '$ParameterPath', $NextLevel )\n" if $self->debug;
126 $self->xml( $state, sub {
127 my ( $X, $state ) = @_;
129 $X->GetParameterNames( $cwmp,
130 $X->ParameterPath( $cwmp, $ParameterPath ),
131 $X->NextLevel( $cwmp, $NextLevel ),
138 $method->Reboot( $state );
143 my ( $self, $state ) = @_;
144 $self->xml( $state, sub {
145 my ( $X, $state ) = @_;
151 =head1 Server methods
154 =head2 InformResponse
156 $method->InformResponse( $state );
161 my ( $self, $state ) = @_;
162 $self->xml( $state, sub {
163 my ( $X, $state ) = @_;
164 $X->InformResponse( $cwmp,
165 $X->MaxEnvelopes( $cwmp, 1 )
172 All other methods are unimplemented.