Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

SOAP Lite arrays

by Mike_v (Novice)
on Aug 16, 2011 at 14:11 UTC ( #920498=perlquestion: print w/replies, xml ) Need Help??

Mike_v has asked for the wisdom of the Perl Monks concerning the following question:

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") ), ) ), ) );

Replies are listed 'Best First'.
Re: SOAP Lite arrays
by trwww (Priest) on Aug 16, 2011 at 19:18 UTC

    Not an answer to your specific question, but:

    SOAP::Lite knows how to normalize perl data structures in to SOAP arguments so I'd try just passing it to your call method, and then fall back to building the object with SOAP::Data if you have problems.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://920498]
Approved by herveus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2020-02-29 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (128 votes). Check out past polls.

    Notices?