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/SKADataService.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->{"kurzname"})->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->{"status"})->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->{"zusatz"})->type("xsd:string"));
}
return(@plz_info);
}
####
# 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);
##
##
$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'
}
];
test
test
1kurzname
1plz
1stadt
1status
1typ
1zusatz
2kurzname
2plz
2stadt
2status
2typ
2zusatz
3kurzname
3plz
3stadt
3status
3typ
3zusatz