Hello,

I am using modperl and SOAP::Lite to implement a tr69 server
(www.dslforum.org), which CPE routers will connect to. As a newbie
to soap, I get into some trouble, and I hope that some of you can
help.

My setup is as following:

httpd.conf:

| Alias /soap_apache/ /home/en/soap_apache/
| 
| <Location /soap_apache>
|         SetHandler perl-script
|         PerlHandler SOAP::Apache
| </Location>

SOAP::Apache:

| package SOAP::Apache;
| 
| use strict;
| 
| use Apache2::RequestUtil;
| use Apache2::RequestRec;
| use Apache2::Const -compile => qw(OK);
| 
| use SOAP::Transport::HTTP;
| $SOAP::Constants::DO_NOT_CHECK_MUSTUNDERSTAND = 1;
| 
| 
| my $server = new SOAP::Transport::HTTP::Apache
|         ->dispatch_with({ 'urn:dslforum-org:cwmp-1-0' => 'thomson'});
| 
| sub handler {
|         my ($r) = shift;
| 
|         # soap::lite does not like content-length set to 0:
|         if($r->headers_in->get('Content-Length') == 0) {
|                 $r->content_type('text/xml');
|                 return Apache2::Const::OK;
|         }
| 
|         $server->handler($r);
| 
| }
| 
| 1;


thomson.pm:

| package thomson;
| 
| use strict;
| use Data::Dumper;
| 
| sub new {
|         bless {}, shift;
| }
| 
| sub Inform {
|         my ($self, $headers, $body, $envelopeMaker) = @_;
| 
|         open(OUT, '>/var/www/tr69.txt');
|         print OUT Dumper([EMAIL PROTECTED]);
|         close OUT;
| 
|         #$body->{extra_stuff} = "heres some extra stuff";
| 
|         #foreach my $header (@$headers) {
|                 #$header->{extra_stuff} = "heres some more extra stuff";
|                 #$envelopeMaker->add_header(undef, undef, 0, 0, $header);
|         #}
|         #$envelopeMaker->set_body(undef, 'myresponse', 0, $body);
| }
| 
| 
| 1;

This works as expected .. so that when a router sends an "Inform",
an "Informresponse" is returned .. my problem is that the arguments
sent to the Inform subroutines are not $headers, $body and
$envelopeMaker .. When I dump the arguments to a file with
Data::Dumper as above, I see this result:

| $VAR1 = [
|           'thomson',
|           {
|             'SerialNumber' => 'CP0550JTMS9',
|             'ProductClass' => 'SpeedTouch 780',
|             'OUI' => '00147F',
|             'Manufacturer' => 'THOMSON'
|           },
|           [
|             bless( {
|                      'EventCode' => '1 BOOT',
|                      'CommandKey' => ''
|                    }, 'EventStruct' ),
|             bless( {
|                      'EventCode' => '2 PERIODIC',
|                      'CommandKey' => ''
|                    }, 'EventStruct' ),
|             bless( {
|                      'EventCode' => '4 VALUE CHANGE',
|                      'CommandKey' => ''
|                    }, 'EventStruct' )
|           ],
|           '2',
|           '1970-01-01T00:10:30Z',
|           '00',
|           [
|             bless( {
|                      'Value' => '1',
|                      'Name' => 'InternetGatewayDevice.DeviceInfo.SpecVersion'
|                    }, 'ParameterValueStruct' ),
|             bless( {
|                      'Value' => 'BANT-R',
|                      'Name' => 
'InternetGatewayDevice.DeviceInfo.HardwareVersion'
|                    }, 'ParameterValueStruct' ),
|             bless( {
|                      'Value' => '6.1.9.6',
|                      'Name' => 
'InternetGatewayDevice.DeviceInfo.SoftwareVersion'
|                    }, 'ParameterValueStruct' ),
|       [...]
|             bless( {
|                      'Value' => '',
|                      'Name' => 
'InternetGatewayDevice.ManagementServer.ParameterKey'
|                    }, 'ParameterValueStruct' ),
|             bless( {
|                      'Value' => '10.0.0.138',
|                      'Name' => '.ExternalIPAddress'
|                    }, 'ParameterValueStruct' )
|           ]
|         ];

In other words, I get a string with the class name, no header, several arguments
from the body, and there is no envelopeMaker (?)

What am I doing wrong? If I am not doing something wrong, how do I
proceed from here in order to craft the soap reply?

-- 
Erland Nylend


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to