Hello all,
I have difficulties to process a certain SOAP reply.
#!/usr/bin/perl
use warnings;
use strict;
use SOAP::Lite;
my $xml = <<'eof';
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/env
+elope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<command id="20070727.103749.843">
<message id="20070727.103749.843">
<commands>
<command/>
</commands>
<time time="27.07.2007-10:37:49 +0200"/>
</message>
</command>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
eof
my $som = SOAP::Deserializer->deserialize($xml);
for my $item ($som->dataof("/Envelope/Body/command/*")) {
print "got 'command' item '", $item->name(), "'\n";
my $i = 1;
for my $subitem ($som->dataof("/Envelope/Body/command/[$i]/*")) {
print "got 'command' subitem $i '", $subitem->name(), "'\n";
my $j = 1;
for my $subsubitem ($som->dataof("/Envelope/Body/command/[$i]/[$j]
+/*")) {
print "got 'command' subsubitem $i:$j '", $subsubitem->name(), "
+'\n";
$j++;
}
$i++;
}
}
If I run this I'll get:
Use of uninitialized value in print at /Users/ar/work/soap/clients/des
+erialize-test.pl line 30.
Use of uninitialized value in print at /Users/ar/work/soap/clients/des
+erialize-test.pl line 33.
Use of uninitialized value in print at /Users/ar/work/soap/clients/des
+erialize-test.pl line 30.
got 'command' item 'message'
got 'command' subitem 1 ''
got 'command' subsubitem 1:1 ''
got 'command' subitem 2 ''
If I change the id-attribute to different values or leave it out completely all runs smooth:
got 'command' item 'message'
got 'command' subitem 1 'commands'
got 'command' subsubitem 1:1 'command'
got 'command' subitem 2 'time'
Is this on purpose?
How could a access the raw XML SOAP body, avoiding to use the SOAP::Deserializer?
Thanks for your time,
Axel.