[Israel.pm] SOAP::Lite and service exploration from WSDL
Uri Bruck
bruck at actcom.net.il
Tue Mar 22 10:01:25 PST 2005
When you install SOAP::Lite it comes with something called stubmaker.pl
It's a very short program and needs only SOAP::Lite
stubmaker the url as an argument and generates a module. The method
definitions are all placed in a hash called %method.
You can run it once on the wsdl you want to use and then use the
generated package, which in turn uses SOAP::Lite. If you want to do real
time, you can read it and do what it does.
It's short enough to quote here in its entirety:
use SOAP::Lite;
print "Accessing...\n";
my $schema = SOAP::Schema
-> schema(shift or die "Usage: $0 <URL with schema description>
[<service> [<port>]]\n")
-> parse(@ARGV);
print "Writing...\n";
foreach (keys %{$schema->services}) {
my $file = "./$_.pm";
print("$file exists, skipped...\n"), next if -s $file;
open(F, ">$file") or die $!;
print F $schema->stub($_);
close(F) or die $!;
print "$file done\n";
}
---
I just ran it this way:
perl /usr/bin/stubmaker.pl
http://soap.amazon.com/schemas2/AmazonWebServices.wsdl
(in one line, and I'm not sure it's the latest version of the Amazon web
services)
and it generated a file called
AmazonSearchService.pm
and it appears to include everything.
Yona Shlomo wrote:
> Hello,
>
> I know the URL of some WSDL file that describes web
> servives.
>
> Anyone knows how I can use a SOAP::Lite client to list the
> available servives at that URL, and their interface? (which
> methods are available, which arguments they expect and what
> return values are expected).
>
> Of course, I can do that by reading the WSDL myself, but I'd
> like to automate the process.
>
> Thanks.
>
--
Thanks,
Uri
http://translation.israel.net
More information about the Perl
mailing list