28 |
my $class = shift; |
my $class = shift; |
29 |
my $self = $class->SUPER::new( @_ ); |
my $self = $class->SUPER::new( @_ ); |
30 |
|
|
31 |
warn "created XML::Generator object" if $self->debug; |
warn "created XML::Generator object\n" if $self->debug; |
32 |
|
|
33 |
return $self; |
return $self; |
34 |
} |
} |
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 |
=head2 Inform |
=head2 InformResponse |
41 |
|
|
42 |
$response->Inform( $state ); |
$response->InformResponse( $state ); |
43 |
|
|
44 |
=cut |
=cut |
45 |
|
|
46 |
sub Inform { |
sub InformResponse { |
47 |
my ( $self, $state ) = @_; |
my ( $self, $state ) = @_; |
48 |
$self->xml( $state, sub { |
$self->xml( $state, sub { |
49 |
my ( $X, $state ) = @_; |
my ( $X, $state ) = @_; |
67 |
}); |
}); |
68 |
}; |
}; |
69 |
|
|
70 |
|
=head2 Reboot { |
71 |
|
|
72 |
|
$response->Reboot( $state ); |
73 |
|
|
74 |
|
=cut |
75 |
|
|
76 |
|
sub Reboot { |
77 |
|
my ( $self, $state ) = @_; |
78 |
|
$self->xml( $state, sub { |
79 |
|
my ( $X, $state ) = @_; |
80 |
|
$X->Reboot(); |
81 |
|
}); |
82 |
|
} |
83 |
|
|
84 |
|
=head2 GetParameterNames { |
85 |
|
|
86 |
|
$response->GetParameterNames( $state, $ParameterPath, $NextLevel ); |
87 |
|
|
88 |
|
=cut |
89 |
|
|
90 |
|
sub GetParameterNames { |
91 |
|
my ( $self, $state, $ParameterPath, $NextLevel ) = @_; |
92 |
|
$ParameterPath ||= ''; # all |
93 |
|
$NextLevel ||= 0; # all |
94 |
|
warn "# GetParameterNames( '$ParameterPath', $NextLevel )\n" if $self->debug; |
95 |
|
$self->xml( $state, sub { |
96 |
|
my ( $X, $state ) = @_; |
97 |
|
|
98 |
|
$X->GetParameterNames( $cwmp, |
99 |
|
$X->ParameterPath( $cwmp, $ParameterPath ), |
100 |
|
$X->NextLevel( $cwmp, $NextLevel ), |
101 |
|
); |
102 |
|
}); |
103 |
|
} |
104 |
|
|
105 |
=head2 xml |
=head2 xml |
106 |
|
|
107 |
Used to implement methods which modify just body of soap message. |
Used to implement methods which modify just body of soap message. |
119 |
|
|
120 |
confess "no ID in state ", dump( $state ) unless ( $state->{ID} ); |
confess "no ID in state ", dump( $state ) unless ( $state->{ID} ); |
121 |
|
|
122 |
|
#warn "state used to generate xml = ", dump( $state ) if $self->debug; |
123 |
|
|
124 |
my $X = XML::Generator->new(':pretty'); |
my $X = XML::Generator->new(':pretty'); |
125 |
|
|
126 |
return $X->Envelope( $soap, { 'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" }, |
return $X->Envelope( $soap, { 'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" }, |
127 |
$X->Header( $soap, |
$X->Header( $soap, |
128 |
$X->ID( $cwmp, { mustUnderstand => 1 }, $state->{ID} ), |
$X->ID( $cwmp, { mustUnderstand => 1 }, $state->{ID} ), |
129 |
|
$X->NoMoreRequests( $cwmp, $state->{NoMoreRequests} || 0 ), |
130 |
), |
), |
131 |
$X->Body( $soap, $closure->( $X, $state ) ), |
$X->Body( $soap, $closure->( $X, $state ) ), |
132 |
); |
); |