Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.8 KiB

  1. #!/bin/env perl
  2. #!d:\perl\bin\perl.exe
  3. # -- SOAP::Lite -- soaplite.com -- Copyright (C) 2001 Paul Kulchenko --
  4. use strict;
  5. use SOAP::Lite;
  6. use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 1;
  7. @ARGV or die "Usage: $0 proxy [uri [commands...]]\n";
  8. my($proxy, $uri) = (shift, shift);
  9. my %can;
  10. my $soap = SOAP::Lite->proxy($proxy)->on_fault(sub{});
  11. $soap->uri($uri) if $uri;
  12. print STDERR "Usage: method[(parameters)]\n> ";
  13. while (defined($_ = shift || <>)) {
  14. next unless /\w/;
  15. my($method) = /\s*(\w+)/;
  16. $can{$method} = $soap->can($method) unless exists $can{$method};
  17. my $res = eval "\$soap->$_";
  18. $@ ? print(STDERR join "\n", "--- SYNTAX ERROR ---", $@, '') :
  19. $can{$method} && !UNIVERSAL::isa($res => 'SOAP::SOM')
  20. ? print(STDERR join "\n", "--- METHOD RESULT ---", $res || '', '') :
  21. defined($res) && $res->fault ? print(STDERR join "\n", "--- SOAP FAULT ---", $res->faultcode, $res->faultstring, '') :
  22. !$soap->transport->is_success ? print(STDERR join "\n", "--- TRANSPORT ERROR ---", $soap->transport->status, '') :
  23. print(STDERR join "\n", "--- SOAP RESULT ---", Dumper($res->paramsall), '')
  24. } continue {
  25. print STDERR "\n> ";
  26. }
  27. __END__
  28. =head1 NAME
  29. SOAPsh.pl - Interactive shell for SOAP calls
  30. =head1 SYNOPSIS
  31. perl SOAPsh.pl http://services.soaplite.com/examples.cgi http://www.soaplite.com/My/Examples
  32. > getStateName(2)
  33. > getStateNames(1,2,3,7)
  34. > getStateList([1,9])
  35. > getStateStruct({a=>1, b=>24})
  36. > Ctrl-D (Ctrl-Z on Windows)
  37. or
  38. # all parameters after uri will be executed as methods
  39. perl SOAPsh.pl http://soap.4s4c.com/ssss4c/soap.asp http://simon.fell.com/calc doubler([10,20,30])
  40. > Ctrl-D (Ctrl-Z on Windows)
  41. =head1 DESCRIPTION
  42. SOAPsh.pl is a shell for making SOAP calls. It takes two parameters:
  43. mandatory endpoint and optional uri (actually it will tell you about it
  44. if you try to run it). Additional commands can follow.
  45. After that you'll be able to run any methods of SOAP::Lite, like autotype,
  46. readable, encoding, etc. You can run it the same way as you do it in
  47. your Perl script. You'll see output from method, result of SOAP call,
  48. detailed info on SOAP faulure or transport error.
  49. For full list of available methods see documentation for SOAP::Lite.
  50. Along with methods of SOAP::Lite you'll be able (and that's much more
  51. interesting) run any SOAP methods you know about on remote server and
  52. see processed results. You can even switch on debugging (with call
  53. something like: C<on_debug(sub{print@_})>) and see SOAP code with
  54. headers sent and recieved.
  55. =head1 COPYRIGHT
  56. Copyright (C) 2000 Paul Kulchenko. All rights reserved.
  57. =head1 AUTHOR
  58. Paul Kulchenko (paulclinger@yahoo.com)
  59. =cut