| 1 | #!/usr/bin/env perl | ||
| 2 | #!d:\perl\bin\perl.exe | ||
| 3 | |||
| 4 | # -- SOAP::Lite -- soaplite.com -- Copyright (C) 2001 Paul Kulchenko -- | ||
| 5 | |||
| 6 | use strict; | ||
| 7 | |||
| 8 | our $VERSION = '1.27'; # VERSION | ||
| 9 | |||
| 10 | use SOAP::Lite; | ||
| 11 | use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 1; | ||
| 12 | |||
| 13 | @ARGV or die "Usage: $0 proxy [uri [commands...]]\n"; | ||
| 14 | my($proxy, $uri) = (shift, shift); | ||
| 15 | my %can; | ||
| 16 | my $soap = SOAP::Lite->proxy($proxy)->on_fault(sub{}); | ||
| 17 | $soap->uri($uri) if $uri; | ||
| 18 | print STDERR "Usage: method[(parameters)]\n> "; | ||
| 19 | while (defined($_ = shift || <>)) { | ||
| 20 | next unless /\w/; | ||
| 21 | my($method) = /\s*(\w+)/; | ||
| 22 | $can{$method} = $soap->can($method) unless exists $can{$method}; | ||
| 23 | my $res = eval "\$soap->$_"; | ||
| 24 | $@ ? print(STDERR join "\n", "--- SYNTAX ERROR ---", $@, '') : | ||
| 25 | $can{$method} && !UNIVERSAL::isa($res => 'SOAP::SOM') | ||
| 26 | ? print(STDERR join "\n", "--- METHOD RESULT ---", $res || '', '') : | ||
| 27 | defined($res) && $res->fault ? print(STDERR join "\n", "--- SOAP FAULT ---", $res->faultcode, $res->faultstring, '') : | ||
| 28 | !$soap->transport->is_success ? print(STDERR join "\n", "--- TRANSPORT ERROR ---", $soap->transport->status, '') : | ||
| 29 | print(STDERR join "\n", "--- SOAP RESULT ---", Dumper($res->paramsall), '') | ||
| 30 | } continue { | ||
| 31 | print STDERR "\n> "; | ||
| 32 | } | ||
| 33 | |||
| 34 | __END__ |