CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Create Data structure in SOAP::Data

 



Bianca
User

Jun 13, 2010, 7:27 AM

Post #1 of 1 (928 views)
Create Data structure in SOAP::Data Can't Post

Please help me with the following problem.
I have to request
[item] => Array
(
["country"] => NL
)
[item] => Array
(
["step"] => 1
)
to the server.

I made

Code
   #!/usr/bin/perl -w    
use strict;
use warnings;
use diagnostics;
use Data::Dumper;
use SOAP::Lite;
my %data_to_send_in_soap_map = (
'country' => 'NL',
'step' => '1',
);
my (@soap_map,@params);
foreach my $key (keys %data_to_send_in_soap_map) {
push @soap_map,
\SOAP::Data -> name ('item') -> value (
SOAP::Data -> name ($key) -> value ($data_to_send_in_soap_map{$key}),
)
;
}
@params = (
SOAP::Data -> name ('params') -> value (@soap_map)
);
print Dumper (\@params);

then 'item' is missing in XML Request:

Code
   Array    
(
[country] => NL
)
Array
(
[step] => 1
)


If i made with square clips in -> value of 'item'

Code
   #!/usr/bin/perl -w    
use strict;
use warnings;
use diagnostics;
use Data::Dumper;
use SOAP::Lite;
my %data_to_send_in_soap_map = (
'country' => 'NL',
'step' => '1',
);
my (@soap_map,@params);
foreach my $key (keys %data_to_send_in_soap_map) {
push @soap_map,
\SOAP::Data -> name ('item') -> value ([
SOAP::Data -> name ($key) -> value ($data_to_send_in_soap_map{$key}),
])
;
}
@params = (
SOAP::Data -> name ('params') -> value (@soap_map)
);
print Dumper (\@params);

then missing the key name, it's always 0:

Code
   Array    
(
[item] => Array
(
[0] => NL
)

)
Array
(
[item] => Array
(
[0] => 1
)

)


The XML request must look like this but I don't know how to do this:

Code
   <params xsi:type="ns2:Map">    
<item>
<key xsi:type="xsd:string">country</key>
<value xsi:type="xsd:string">NL</value>
</item>
<item>
<key xsi:type="xsd:string">step</key>
<value xsi:type="xsd:string">1</value>
</item>
</params>


Please help to form the needed request.
Thanks!

Edit: Crosspost http://www.perl-community.de/bat/poard/thread/15136


(This post was edited by Bianca on Jun 13, 2010, 9:37 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives