I'm trying to create a soap call that sends multiple entries for the section items from a set of data. I've done soap calls before via Perl but never had to do it for more than one item at a time.

The number of items varies so not sure how to make this flexible. XX will be popluated by data returned from sql queries.

@params = (SOAP::Data->name("ordercreate" => \SOAP::Data->value (SOAP::Data->name(order =>"123456"), SOAP::Data->name("items" => \SOAP::Data->value (SOAP::Data->name(itemid => "1"), SOAP::Data->name("details" => \SOAP::Data->value (SOAP::Data->name(var1 => "ite +m1_value1"), SOAP::Data->name(var2 => "ite +m1_value2") ), ), SOAP::Data->name(order_var1 => "var"), SOAP::Data->name(order_var1 => "var"), SOAP::Data->name(order_var1 => "var") ), ) ), ) ); $method = SOAP::Data->name('ext:TaskCreateLBG') ->attr({'xmlns:ext' => $uri},{xmlns => $uri}), ; $soap = SOAP::Lite -> uri($uri) -> on_action( sub { 'TaskCreateLBG' } ) -> proxy($proxy,timeout=>$timeout) ; $result = $soap->call($method => @params);

Effectively for 2 items it would read but as I don't know how many items there'll be this needs to be dynamic from my sql return. Any help much appreciated

@params = (SOAP::Data->name("ordercreate" => \SOAP::Data->value (SOAP::Data->name(order =>"123456"), SOAP::Data->name("item1" => \SOAP::Data->value (SOAP::Data->name(itemid => "1"), SOAP::Data->name("details" => \SOAP::Data->value (SOAP::Data->name(var1 => "ite +m1_value1"), SOAP::Data->name(var2 => "ite +m1_value2") ), ), SOAP::Data->name("item2" => \SOAP::Data->value (SOAP::Data->name(itemid => "2"), SOAP::Data->name("details" => \SOAP::Data->value (SOAP::Data->name(var1 => "ite +m2_value1"), SOAP::Data->name(var2 => "ite +m2_value2") ), ), SOAP::Data->name(order_var1 => "var"), SOAP::Data->name(order_var1 => "var"), SOAP::Data->name(order_var1 => "var") ), ) ), ) );

In reply to SOAP Lite arrays by Mike_v

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.