axelrose has asked for the wisdom of the Perl Monks concerning the following question:
If I run this I'll get:#!/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 change the id-attribute to different values or leave it out completely all runs smooth: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 ''
Is this on purpose? How could a access the raw XML SOAP body, avoiding to use the SOAP::Deserializer? Thanks for your time, Axel.got 'command' item 'message' got 'command' subitem 1 'commands' got 'command' subsubitem 1:1 'command' got 'command' subitem 2 'time'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SOAP::Deserializer problem
by radiantmatrix (Parson) on Jul 27, 2007 at 14:49 UTC | |
by axelrose (Scribe) on Jul 28, 2007 at 04:53 UTC | |
by radiantmatrix (Parson) on Jul 30, 2007 at 14:24 UTC | |
by axelrose (Scribe) on Jul 30, 2007 at 15:52 UTC | |
|
Re: SOAP::Deserializer problem
by rahed (Scribe) on Jul 28, 2007 at 18:01 UTC | |
by axelrose (Scribe) on Jul 29, 2007 at 11:32 UTC | |
by rahed (Scribe) on Jul 29, 2007 at 18:16 UTC | |
by axelrose (Scribe) on Jul 29, 2007 at 18:47 UTC | |
by rahed (Scribe) on Jul 31, 2007 at 10:04 UTC | |
|