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.

In reply to SOAP::Deserializer problem by axelrose

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.