Files
SOAP-WSDL/example/hello_lite.pl
Martin Kutter 874251225f import SOAP-WSDL 2.00_29 from CPAN
git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00_29
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_29.tar.gz
2009-12-12 19:48:17 -08:00

30 lines
795 B
Perl

#!/usr/bin/perl -w
#use strict;
use warnings;
use SOAP::Lite +trace;
# I have to lookup the URL from the WSDL
my $soap = SOAP::Lite->new(
proxy => 'http://localhost:81/soap-wsdl-test/helloworld.pl'
);
# I have to lookup the SOAPAction from the WSDL
$soap->on_action( sub { "urn:HelloWorld#sayHello" });
$soap->autotype(0);
# I have to lookup the top level element's namespace from the WSDL
$soap->default_ns('urn:HelloWorld');
# I have to encode all parameters as SOAP::Data objects
# I have to know the order of parameters
my $som = $soap->call(
"sayHello",
SOAP::Data->name('name')->value( $ARGV[1] || '"Your name"'),
SOAP::Data->name('givenName')->value( $ARGV[0] || '"Your given name"'),
);
die $som->fault->{ faultstring } if ($som->fault);
print $som->result, "\n";