How can I run a command after enabling SOAP to AzerothCore worldserver console?
How to send commands using SOAP to AzerothCore worldserver console?
2.2k Views Asked by Stefano Borzì At
2
There are 2 best solutions below
0
On
Here is a perl script to do the same thing, it requires libsoap-lite-perl, install with apt-get install libsoap-lite-perl
Put the code below in a file named soap.pl:
#!/usr/bin/perl
use strict;
use warnings;
use SOAP::Lite; # visit http://search.cpan.org/dist/SOAP-Lite/ or apt-get install libsoap-lite-perl
my ($user, $pass) = ('gm_account', '1234');
my $host = 'http://127.0.0.1:7878/';
my $cmd = '.server info';
BEGIN {
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
return $user => $pass,
}
}
my $soap = SOAP::Lite
->proxy($host)
->uri('urn:AC');
my $rc = $soap->call('executeCommand',
SOAP::Data->name('command')->value($cmd));
die $rc->faultstring if ($rc->fault);
print
$rc->result;
Then start your worldserver and run like that perl soap.pl.
It should return the result of the command ".server info"
First of all, you have to put on
worldserver.confthese parameters to enable SOAP:Afterwards, run your
worldserver.You can use a simple PHP script to run a command to the AzerothCore console like the following,
If you don't have
php-soap, on Linux Ubuntu you can install it usingsudo apt install php-soap(orphp7.2-soap).In the last line you have to change
"account_name","account_password"using an account with gm level 3.echo RemoteCommandWithSOAP($soap_connection_info['account_name'], $soap_connection_info['account_password'], ".server info");You can replace
.server infowith any command.Note: this works with other emulators just replacing
urn:ACwith:-
urn:MaNGOSfor CMaNGOS (and related forks)-
urn:TCfor TrinityCore-
urn:SFfor SkyfireProject-
urn:Oregonfor OregonCoreetc...