#!/usr/bin/perl -w use 5.008; use strict; use diagnostics; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use Data::Dumper; $Data::Dumper::Sortkeys = \&dumper_filter; sub dumper_filter { my ($hash) = @_; return [(sort {lc $a cmp lc $b} keys %$hash)]; } $| ++; my $iban_wsdl_getform = 'http://dev.iban-bic.com/Riban/soap2/'; my %account = ( 'acc_user' => 'test', 'acc_pass' => 'test', ); my $cgi = CGI -> new; print $cgi -> header; print $cgi -> start_html ('Test Escape SOAP Content'); print $cgi -> p ('- Begin of script -'); my $modul = 1; eval "use SOAP::Lite; 1;" or $modul = 0; if ($modul) { my $version = SOAP::Lite -> VERSION; print $cgi -> p ("SOAP::Lite $version detected"); my $soap = SOAP::Lite -> new (); # get input mask $soap -> proxy ($iban_wsdl_getform); my ($hash_ref,@params); my %parameter = ( 'country' => 'NL', ); foreach my $key (%parameter) { push @params, \SOAP::Data -> value ( SOAP::Data -> name ('key' => $key) -> type ('xsd:string'), SOAP::Data -> name ('value' => $parameter{$key}) -> type ('xsd:string'), ); } print $cgi -> p ('SENDE:
' . Dumper (\@params) . '
'); eval { # do it in eval because smallest errors always cause hard abort in SOAP::Lite # !!ATTENTION!! The SOAP map always must be the first parameter, # username und password always have to be second and third parameter! $hash_ref = $soap -> get_form ( SOAP::Data -> name ('params' => \@params) -> type ('tns:Map'), SOAP::Data -> name ('user' => $account{'acc_user'}) -> type ('xsd:string'), SOAP::Data -> name ('password' => $account{'acc_pass'}) -> type ('xsd:string'), ); }; if (defined $hash_ref) { my $result = $hash_ref -> result; print $cgi -> p ("ERHALTE:
" . Dumper (\$result) . "
"); } else { print $cgi -> p ( "Sorry, one or more internal errors occurred!" . "
Do you perform your request in correct order, first=map, second=user, third=password?" ); } } else { print $cgi -> p ("Sorry, can't find SOAP::Lite!"); } print $cgi -> p ('- End of script -'); print $cgi -> end_html;