Well thats not detailed enough to be pseudocode, but
OK, if you really want to stick with that strategy, here it is:
while($sth->fetch()) {
my %hash;
# Hash zusammenbasteln
$hash{"kurzname"} = $kurzname;
$hash{"plz"} = $plz;
$hash{"stadt"} = $stadt;
$hash{"status"} = $status;
$hash{"typ"} = $typ;
$hash{"zusatz"} = $zusatz;
push(@ary,\%hash);
}
$sth->finish();
$dss->updatePLZInformationen(\@ary);
sub updatePLZInformationen {
my $dss = shift;
my $data = shift;
my $plz = SOAP::Lite
-> service('file:/home/orca/oracle/DataSyncTool/config/SKADataServ
+ice.wsdl');
$plz->updatePLZInformationen(
SOAP::Data->type("xsd:string")->name( "clientid" => "test"
+),
SOAP::Data->type("xsd:string")->name( "securitytoken" => "test
+" ),
SOAP::Data->type("tns2:PLZInfo")->name("plzinfos")->value(
\SOAP::Data->value(
format_plz_infos($data)
)
)
);
}
# --------------------------------------------------------------------
+---------------------------- #
sub format_plz_infos {
my $plz = shift;
my @plz_info;
foreach(@$plz) {
my $hash = $_;
push(@plz_info,SOAP::Data->name("kurzname")->value($hash->{"ku
+rzname"})->type("xsd:string"));
push(@plz_info,SOAP::Data->name("plz")->value($hash->{"plz"})-
+>type("xsd:string"));
push(@plz_info,SOAP::Data->name("stadt")->value($hash->{"stadt
+"})->type("xsd:string"));
push(@plz_info,SOAP::Data->name("status")->value($hash->{"stat
+us"})->type("xsd:string"));
push(@plz_info,SOAP::Data->name("typ")->value($hash->{"typ"})-
+>type("xsd:string"));
push(@plz_info,SOAP::Data->name("zusatz")->value($hash->{"zusa
+tz"})->type("xsd:string"));
}
return(@plz_info);
}
for testing I used
# dummy data
my @ary =
map {
my $t = $_;
scalar {
map {$_ => "$t$_"}
qw! kurzname plz stadt status typ zusatz !
};
} 1 .. 3;
use Data::Dumper;local $Data::Dumper::Indent=1;print Dumper(\@ary);
updatePLZInformationen("dss",\@ary);
and the output was
$VAR1 = [
{
'kurzname' => '1kurzname',
'zusatz' => '1zusatz',
'status' => '1status',
'plz' => '1plz',
'stadt' => '1stadt',
'typ' => '1typ'
},
{
'kurzname' => '2kurzname',
'zusatz' => '2zusatz',
'status' => '2status',
'plz' => '2plz',
'stadt' => '2stadt',
'typ' => '2typ'
},
{
'kurzname' => '3kurzname',
'zusatz' => '3zusatz',
'status' => '3status',
'plz' => '3plz',
'stadt' => '3stadt',
'typ' => '3typ'
}
];
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc
+oding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:
+soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http:/
+/www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSche
+ma-instance">
<soap:Body>
<updatePLZInformationen>
<clientid xsi:type="xsd:string">test</clientid>
<securitytoken xsi:type="xsd:string">test</securitytoken>
<plzinfos xsi:type="tns2:PLZInfo">
<kurzname xsi:type="xsd:string">1kurzname</kurzname>
<plz xsi:type="xsd:string">1plz</plz>
<stadt xsi:type="xsd:string">1stadt</stadt>
<status xsi:type="xsd:string">1status</status>
<typ xsi:type="xsd:string">1typ</typ>
<zusatz xsi:type="xsd:string">1zusatz</zusatz>
<kurzname xsi:type="xsd:string">2kurzname</kurzname>
<plz xsi:type="xsd:string">2plz</plz>
<stadt xsi:type="xsd:string">2stadt</stadt>
<status xsi:type="xsd:string">2status</status>
<typ xsi:type="xsd:string">2typ</typ>
<zusatz xsi:type="xsd:string">2zusatz</zusatz>
<kurzname xsi:type="xsd:string">3kurzname</kurzname>
<plz xsi:type="xsd:string">3plz</plz>
<stadt xsi:type="xsd:string">3stadt</stadt>
<status xsi:type="xsd:string">3status</status>
<typ xsi:type="xsd:string">3typ</typ>
<zusatz xsi:type="xsd:string">3zusatz</zusatz>
</plzinfos>
</updatePLZInformationen>
</soap:Body>
</soap:Envelope>
.