Advertisement
Kylroi

TC admin script to send worldserver command - SOAP interface

Oct 30th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.77 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2.  
  3. #use strict;
  4. use SOAP::Lite;
  5.  
  6. # site variables (edit these)
  7. my $server = '<host address/name>:7878';
  8. my $username = 'user';
  9. my $password = 'password';
  10. # end of site variables
  11.  
  12. my $link = SOAP::Lite
  13.    -> uri('urn:TC')
  14.    -> proxy("http://$username:$password\@$server/");
  15.  
  16. if ($#ARGV == -1) {
  17.   print "worldserver command not provided\n\n";
  18.   exit;
  19. }
  20.  
  21. if ($#ARGV == 0) {
  22.   $command = $ARGV[0];
  23. } else {
  24.   for (my $l=0; $l <= $#ARGV; $l++) {
  25.     $command .= $ARGV[$l];
  26.     if ($l != $#ARGV) {
  27.       $command .= " ";
  28.     }
  29.   }
  30. }
  31.  
  32. my $results = $link->executeCommand(SOAP::Data->name('command')->value("$command"));
  33.  
  34. # error trap - untested, so commented out
  35. #die $link->fault->{ faultstring } if ($link->fault);
  36. print $results->result, "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement