Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^5: Problems with SOAP::Lite client

by Anonymous Monk
on Dec 15, 2008 at 15:58 UTC ( #730438=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Problems with SOAP::Lite client
in thread Problems with SOAP::Lite client

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>
I suggest a refresher of perlsub/perldata.


Comment on Re^5: Problems with SOAP::Lite client
Select or Download Code
Re^6: Problems with SOAP::Lite client
by thion (Initiate) on Dec 16, 2008 at 09:27 UTC
    Hi,

    thanks for all the help. I definitely will do a refresher of perlsub/perldata.
    I built your suggestions into my code.
    And here's the output:
    test@testmachine:~/test/DataSyncTool> ./data_sync_tool.pl 16:12:2008 09:14:13, DEBUG: Programm gestartet... 16:12:2008 09:14:13, DEBUG: updatePLZInformationen => Data of plz tabl +e: 1 => 01001 => Dresden => Dresden => => 1 => 3 2 => 01002 => Dresden => Dresden => => 1 => 3 3 => 01003 => Dresden => Dresden => => 1 => 3 4 => 01004 => Dresden => Dresden => => 1 => 3 DataSyncTool: HASH(0x86d81f8) HASH(0x8740d38) HASH(0x88058c0) HASH(0x8 +805920) Yeehah: DatenService=HASH(0x8743344) Yeehah: DatenService=HASH(0x8743344) 16:12:2008 09:14:13, DEBUG: updatePLZInformationen => FEHLER: Not an ARRAY reference at data_service.pm line 161. 16:12:2008 09:14:13, DEBUG: updatePLZInformationen => Fertig.
    The error message is in the subroutine format_plz_infos():
    foreach(@$plz) { ... }
    I'm no perl specialist, unfortunately, and I surely have a lack of basics, but I really need some advice to get this client working... :-/

    Thanks in advance,

    Thion
      Do it again, this time just cut/paste and add comments. Do not make any other modifications.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-10-24 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (138 votes), past polls