Files
SOAP-WSDL/example/fortune.pl
Martin Kutter a554e87f49 import SOAP-WSDL 2.00_09 from CPAN
git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00_09
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_09.tar.gz
2009-12-12 19:47:47 -08:00

47 lines
1.3 KiB
Perl

# Accessing the fortune cookie service at
# www.fullerdata.com/FortuneCookie/FortuneCookie.asmx
#
# I have no connection to www.fullerdata.com
#
# Use this script at your own risk.
# Run before:
# D:\Eigene Dateien\Martin\SOAP-WSDL\trunk>perl -I../lib wsdl2perl.pl "file:///D:/
# Eigene Dateien/Martin/SOAP-WSDL/trunk/bin/FortuneCookie.xml"
use lib 'lib/';
use MyInterfaces::FullerData_x0020_Fortune_x0020_Cookie;
my $cookieService = MyInterfaces::FullerData_x0020_Fortune_x0020_Cookie->new();
my $cookie;
$cookie = $cookieService->GetFortuneCookie()
or die "$cookie";
print $cookie; # ->get_GetFortuneCookieResult()->get_value, "\n";
$cookie = $cookieService->GetSpecificCookie({ index => 23 })
or die "$cookie";
print $cookie->get_GetSpecificCookieResult(), "\n";
print $cookie;
=for demo:
# the same in SOAP lite (second call)
#
use SOAP::Lite;
my $lite = SOAP::Lite->new()->on_action(sub { join '/', @_ } )
->proxy('http://www.fullerdata.com/FortuneCookie/FortuneCookie.asmx');
$lite->call(
SOAP::Data->name('GetSpecificCookie')
->attr({ 'xmlns', 'http://www.fullerdata.com/FortuneCookie/FortuneCookie.asmx' }),
SOAP::Data->name('index')->value(23)
);
die $soap->message() if ($soap->fault());
print $soap->result();