10 |
|
|
11 |
=head1 NAME |
=head1 NAME |
12 |
|
|
13 |
CWMP::Request - parse SOAP request |
CWMP::Request - parse SOAP request metods |
14 |
|
|
15 |
=head1 METHODS |
=head1 METHODS |
16 |
|
|
45 |
} |
} |
46 |
} |
} |
47 |
|
|
48 |
|
=head2 parse |
49 |
|
|
50 |
|
my $state = CWMP::Request->parse( "<soap>request</soap>" ); |
51 |
|
|
52 |
|
=cut |
53 |
|
|
54 |
|
sub parse { |
55 |
|
my $self = shift; |
56 |
|
|
57 |
|
my $xml = shift || confess "no xml?"; |
58 |
|
|
59 |
|
$state = {}; |
60 |
|
$parser->parsestring( $xml ); |
61 |
|
return $state; |
62 |
|
} |
63 |
|
|
64 |
|
=head1 CPE metods |
65 |
|
|
66 |
|
=cut |
67 |
|
|
68 |
our $state; # FIXME check this! |
our $state; # FIXME check this! |
69 |
|
|
70 |
my $tree = CWMP::Tree->new({ debug => 0 }); |
my $tree = CWMP::Tree->new({ debug => 0 }); |
90 |
my ($tag_name, $tag_hash, $context, $parent_data) = @_; |
my ($tag_name, $tag_hash, $context, $parent_data) = @_; |
91 |
$state->{ID} = $tag_hash->{_content}; |
$state->{ID} = $tag_hash->{_content}; |
92 |
}, |
}, |
93 |
# |
|
94 |
# Inform |
=head2 Inform |
95 |
# |
|
96 |
|
Generate InformResponse to CPE |
97 |
|
|
98 |
|
=cut |
99 |
|
|
100 |
'Inform' => sub { |
'Inform' => sub { |
101 |
$state->{_dispatch} = 'InformResponse'; # what reponse to call |
$state->{_dispatch} = 'InformResponse'; # what reponse to call |
102 |
}, |
}, |
123 |
my $value = (grep( /value/i, keys %$tag_hash ))[0]; |
my $value = (grep( /value/i, keys %$tag_hash ))[0]; |
124 |
$state->{Parameter}->{ _tag($tag_hash, 'Name', '_content') } = _tag($tag_hash, 'Value', '_content' ); |
$state->{Parameter}->{ _tag($tag_hash, 'Name', '_content') } = _tag($tag_hash, 'Value', '_content' ); |
125 |
}, |
}, |
126 |
# |
|
127 |
# GetRPCMethodsResponse |
=head2 GetRPCMethodsResponse |
128 |
# |
|
129 |
|
=cut |
130 |
qr/^(?:^\w+:)*string$/ => 'content array', |
qr/^(?:^\w+:)*string$/ => 'content array', |
131 |
'MethodList' => sub { |
'MethodList' => sub { |
132 |
my ($tag_name, $tag_hash, $context, $parent_data) = @_; |
my ($tag_name, $tag_hash, $context, $parent_data) = @_; |
133 |
$state->{MethodList} = _tag( $tag_hash, 'string' ); |
$state->{MethodList} = _tag( $tag_hash, 'string' ); |
134 |
}, |
}, |
135 |
# |
|
136 |
# GetParameterNamesResponse |
=head2 GetParameterNamesResponse |
137 |
# |
|
138 |
|
=cut |
139 |
|
|
140 |
'ParameterInfoStruct' => sub { |
'ParameterInfoStruct' => sub { |
141 |
my ($tag_name, $tag_hash, $context, $parent_data) = @_; |
my ($tag_name, $tag_hash, $context, $parent_data) = @_; |
142 |
my $name = _tag($tag_hash, 'Name', '_content'); |
my $name = _tag($tag_hash, 'Name', '_content'); |
151 |
|
|
152 |
#warn "## state = dump( $state ), "\n"; |
#warn "## state = dump( $state ), "\n"; |
153 |
}, |
}, |
154 |
# |
|
155 |
# Fault |
=head2 Fault |
156 |
# |
|
157 |
|
=cut |
158 |
|
|
159 |
'Fault' => sub { |
'Fault' => sub { |
160 |
my ($tag_name, $tag_hash, $context, $parent_data) = @_; |
my ($tag_name, $tag_hash, $context, $parent_data) = @_; |
161 |
$state->{Fault} = { |
$state->{Fault} = { |
167 |
] |
] |
168 |
); |
); |
169 |
|
|
|
=head2 parse |
|
|
|
|
|
my $state = CWMP::Request->parse( "<soap>request</soap>" ); |
|
|
|
|
|
=cut |
|
|
|
|
|
sub parse { |
|
|
my $self = shift; |
|
|
|
|
|
my $xml = shift || confess "no xml?"; |
|
|
|
|
|
$state = {}; |
|
|
$parser->parsestring( $xml ); |
|
|
return $state; |
|
|
} |
|
|
|
|
170 |
1; |
1; |