I'm struggling with Perl (v5.24.1) SOAP::Lite. i'm trying to add an element to
an existing Data element.
Assume i have the following construct:
use SOAP::Lite + qw/ trace /;
my $soap = SOAP::Lite->new( proxy => 'http://soap.server.com');
$soap->on_action( sub { "http://tempuri.org/some" });
$soap->autotype(0)->readable(1);
$soap->default_ns('http://tempuri.org/');
$som = $soap->call('GetItems', SOAP::Data->name('Store')->attr( { 'xmlns' => 'Some.Structs'} )->value(
\SOAP::Data->value(
SOAP::Data->name('Items')->value(
\SOAP::Data->value(
SOAP::Data->name('Available')->value('false'),
SOAP::Data->name('Apple')->value('1'),
SOAP::Data->name('Orange')->value('2'),
)),
)),
);
But now i'd like to add 'N' Elements of Items, i want to this in a loop based on conditions so thats just an example, i tried the following:
use SOAP::Lite + qw/ trace /;
my $soap = SOAP::Lite->new( proxy => 'http://soap.server.com');
$soap->on_action( sub { "http://tempuri.org/some" });
$soap->autotype(0)->readable(1);
$soap->default_ns('http://tempuri.org/');
my $data1= (SOAP::Data->name('Store')->attr( { 'xmlns' => 'Some.Structs'} )->value(
\SOAP::Data->value(
SOAP::Data->name('Items')->value(
\SOAP::Data->value(
SOAP::Data->name('Available')->value('false'),
SOAP::Data->name('Apple')->value('1'),
SOAP::Data->name('Orange')->value('2'),
)),
)),
);
my $data2= (SOAP::Data->name('Store')->attr( { 'xmlns' => 'Some.Structs'} )->value(
\SOAP::Data->value(
SOAP::Data->name('Items')->value(
\SOAP::Data->value(
SOAP::Data->name('Available')->value('true'),
SOAP::Data->name('Bananas')->value('4'),
SOAP::Data->name('Pineapple')->value('2'),
)),
)),
);
Now trying to add the element
push $data1->value, data2;
Or
push ($data1,$data1);
The return is: Experimental push on scalar is now forbidden ....
Finally, when the elements are joined i'd like to send them but i'm not sure if this would work:
$som = $soap->call('GetItems', $data1);
Any help would be much appreciated ....