WSDL Tutorials - Herong's Tutorial Examples - Version 2.02, by Dr. Herong Yang
Introduction of Perl SOAP::Lite 0.710 for WSDL
This section describes main steps of using SOAP::Lite 0.710 module to write a Perl script to call a RPC method based Web service by loading its WSDL document.
If you want to write Perl scripts to use WSDL documents, you can use the SOAP::Lite module. On my Windows system, I have ActivePerl 5.8.8 and SOAP::Lite 0.710 installed.
Based on the SOAP::Lite 0.710 manual, here is how you should use an RPC method based WSDL document to make a Web service call in Perl.
1. Import SOAP::Lite module with "use" statement. "+trace" gives your trace output for debugging.
use SOAP::Lite +trace;
2. Create a client object by loading the WSDL document with the service() method. For example:
my $client = SOAP::Lite ->service('http://www.herongyang.com/Service/' . 'GetExchangeRate_WSDL_11_SOAP_11_RPC.wsdl');
3. Call the operation defined in the WSDL as a method, if this is an rpc message style. For example:
$result = $client->GetExchangeRate('USD', 'JPY', '2007-07-07');
4. The result is the returned value. For example:
print "Exchange rate is: $result\n";
To use an XML document based Web service, more steps are required. More details are provided in next tutorials.
Last update: 2009.
Table of Contents