It took me a little bit to figure out what the problem was ...

Here's a minimal test case:

use SOAP::Lite; my $VAR = bless( { 'keys' => bless( [ 'name', 'addr', 'phone' ], 'string' ), 'values' => bless( [ 'bubba', 'home', '555-1212' ], 'string') }, 'HashMapBean' ); my $xml = SOAP::Serializer->serialize($VAR);

Because you've cast the array as a 'string', it's calling the 'as_string' method, which doesn't like references. You'd have to cast each one individually as strings ... which you can't do, because they're not references. But you don't actually have to cast items as strings (which you need to use SOAP::Data for), unless isn't something that SOAP::Lite might incorrectly guess on (eg, if it's all digits, it'll look like a number, and might be cast as an int)

use SOAP::Lite; my $VAR = bless( { 'keys' => bless( [ 'name', 'addr', 'phone' ], 'ArrayOf_xsd_string' ), 'values' => bless( [ 'bubba', 'home', '555-1212' ], 'ArrayOf_xsd_string') }, 'HashMapBean' ); my $xml = SOAP::Serializer->serialize($VAR); print "\n$xml\n\n";

You can also find good information on dealing with more complex structures in SOAP::Lite at Byrne Reese's website


In reply to Re: Soap::Lite and Complex Types by jhourcle
in thread Soap::Lite and Complex Types by BaldPenguin

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.