| 1 | #!/usr/bin/env perl | ||
| 2 | #!d:\perl\bin\perl.exe | ||
| 3 | # | ||
| 4 | # Filename: stubmaker.pl | ||
| 5 | # Authors: Byrne Reese <byrne at majordojo dot com> | ||
| 6 | # Paul Kulchenko | ||
| 7 | # | ||
| 8 | # Copyright (C) 2005 Byrne Reese | ||
| 9 | # | ||
| 10 | # Usage: | ||
| 11 | # stubmaker.pl -[vd] <WSDL URL> | ||
| 12 | ################################################### | ||
| 13 | |||
| 14 | our $VERSION = '1.27'; # VERSION | ||
| 15 | |||
| 16 | use SOAP::Lite; | ||
| 17 | use Getopt::Long; | ||
| 18 | |||
| 19 | my $VERBOSE = 0; | ||
| 20 | my $DIRECTORY = "."; | ||
| 21 | GetOptions( | ||
| 22 | 'd=s' => \$DIRECTORY, | ||
| 23 | 'v' => \$VERBOSE, | ||
| 24 | help => sub { HELP_MESSAGE(); }, | ||
| 25 | version => sub { VERSION_MESSAGE(); exit(0); }, | ||
| 26 | ) or HELP_MESSAGE(); | ||
| 27 | |||
| 28 | HELP_MESSAGE() unless $ARGV[0]; | ||
| 29 | |||
| 30 | my $WSDL_URL = shift; | ||
| 31 | |||
| 32 | print "Writing stub files...\n" if $VERBOSE; | ||
| 33 | my %services = %{SOAP::Schema->schema_url($WSDL_URL) | ||
| 34 | ->cache_ttl(1) | ||
| 35 | ->cache_dir($DIRECTORY) | ||
| 36 | ->parse() | ||
| 37 | ->load | ||
| 38 | ->services}; | ||
| 39 | Carp::croak "More than one service in service description. Service and port names have to be specified\n" | ||
| 40 | if keys %services > 1; | ||
| 41 | |||
| 42 | sub VERSION_MESSAGE { | ||
| 43 | print "$0 $SOAP::Lite::VERSION (C) 2005 Byrne Reese.\n"; | ||
| 44 | } | ||
| 45 | |||
| 46 | sub HELP_MESSAGE { | ||
| 47 | VERSION_MESSAGE(); | ||
| 48 | print <<EOT; | ||
| 49 | usage: $0 -[options] <WSDL URL> | ||
| 50 | options: | ||
| 51 | -v Verbose Outputbe quiet | ||
| 52 | -d <dirname> Output directory | ||
| 53 | EOT | ||
| 54 | exit 0; | ||
| 55 | } | ||
| 56 | |||
| 57 | __END__ |