Jump to content
TrinityCore

Using SOAP without PHP


lalalastab
 Share

Recommended Posts

I've been trying to implement my own simple cms solution without php, but can't figure out the formatting of the SOAP requests. I was wondering if anyone was able to explain where I can find the wsdl schema? Googling only really gives results for php...

edit2 solved after 2 days. feel free to close. code was updated with correct structure. make sure to set basic authentication headers in your request.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:ns1="urn:TC">
    <SOAP-ENV:Header>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
         <ns1:executeCommand>
             <command>server info</command>
         </ns1:executeCommand>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The code is enough to get to the authorization stage but I'm not sure how to log in.

Thanks!

Edited by lalalastab
fix
Link to comment
Share on other sites

  • 5 months later...
On 2/14/2017 at 1:26 PM, lalalastab said:

I've been trying to implement my own simple cms solution without php, but can't figure out the formatting of the SOAP requests. I was wondering if anyone was able to explain where I can find the wsdl schema? Googling only really gives results for php...

3

What language are you trying to use? Once you get the syntax down, anything will work. Just remember it's a SOAP RPC call and not an Ajax call.

Here is a perl version of the php code essentially.
 

#!/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', 'secret');
my $host          = 'http://127.0.0.1:7878/';
my $cmd           = $ARGV[0];

BEGIN {
    sub SOAP::Transport::HTTP::Client::get_basic_credentials {
        return $user => $pass,
    }
}

my $soap = SOAP::Lite
    ->proxy($host)
    ->uri('urn:TC'); # trinitycore namespace
#    ->uri('urn:MaNGOS'); # mangos namespace

my $rc = $soap->call('executeCommand',
            SOAP::Data->name('command')->value($cmd));

die $rc->faultstring if ($rc->fault);

print
    $rc->result;





 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Lenny4
      I'm currently developping a web site to allow user to create an account and play in the game. For that I'm using soap connection, this way I can execute gm command from my website. (like bnetaccount create ...)
      I was wondering, if one day I have a lot of players and I need to limit the amount of players who can be connect in the game at the same time.
      But I want to choose (I will not choose my self I will create a php script for that) wich one can connect or not.
      So my questions are:
      - is there a way to know when a user try to connect in game, I mean a request is send to my website (or another way)? how?
                       - if yes can I avoid the connection to the game? how?
      - is there a way to disconnect a user in the game using soap command (or another way)? how? Because here https://trinitycore.atlassian.net/wiki/spaces/tc/pages/2130065/GM+Commands I can't find a command to disconnect a player
      Thank you for your help.
    • By elandris
      I am attempting to allow a php script to connect remotely to soap, but soap does not seem to be listening on the default port 7878. I've attempted to change the port to see if any changes occur and do not see any results. Trinity Core is installed on Windows 7 pro. I've used an elevated CMD netstat -a -b and cannot see the specified port listed. I have enabled soap and RA in the config file. Any ideas on where i can look? 
      Soap Connection issue.pdf
      Soap Connection issue
      Soap Connection Issue.pcapng
       
       
    • By BRABUS
      Hi all, im trying now to make an php custom market for buying an items in website, and i would ask for help. Which is the proper way to add/send items to player with in-game mail?
      I need to add new entry in mail, mail_item, and item_instance ???
      Something like that? 
      $mail->insert( 'mail', array( 'messageType' => 0, 'stationery' => 61, 'mailTemplateId' => 0, 'sender' => 1, 'receiver' => 2, 'subject' => 'Market item', 'body' => 'You have successfully buyed an item from market!', 'has_items' => 1, 'checked' => 0 ), array( '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%d', '%d' ) ); $mail->insert( 'mail_items', array( 'mail_id' => 44, 'item_guid' => 61, // ???? 'receiver' => 0 ), array( '%d', '%d', '%d' ) );  
      Thanks.
    • By darki73
      So i guess it is pretty obvious about what am i going to ask =)
      Problem is, previousle we could just sha1 username and password separated by colon and here is the sha_pass_hash.
      The problem i am facing right now, is that according to https://github.com/TrinityCore/TrinityCore/blob/86b98686a95e23247ecb774fb23ecd5b8d94b97b/src/server/game/Accounts/BattlenetAccountMgr.cpp#L177 Trinity now uses SHA256, so the hashes do not match anymore. The thing is, password length in database is 40 symbols (exactly as many as in sha1 hash), but sha256 hash length is 64 characters long. I am confused...
      I've tried to recreate whole "Cryptography" thing on PHP but, guess what, failed.
      Can somebody explain me how the password is generated nowadays?
      Thank you for your attention. 
    • By goruki
      Hello people ! (First of all, sorry for my bad english ...)
      I have few trouble with using SOAP in 6.2.4
      I tried something like this : 
      05.        $client = new SoapClient(NULL, array(
      06.                'location'      => "http://127.0.0.1:7878/",
      07.                'uri'           => 'urn:TC',
      08.                'style'         => 'SOAP_RPC',
      09.                'login'         => '[email protected]',
      10.                'password'  => 'mypass'
      11.        ));
      12.        $client->executeCommand(new SoapParam('server info', 'command'));
       
      It gives me an 401 error. 
      Return looks like  :
      PHP Fatal error:  Uncaught SoapFault exception: [SOAP-ENV:Client] HTTP Error: 401 Unauthorized in /var/www/html/SOAP/index.php:12
      Stack trace:
      #0 /var/www/html/SOAP/index.php(12): SoapClient->__call('executeCommand', Array)
      #1 /var/www/html/SOAP/index.php(12): SoapClient->executeCommand(Object(SoapParam))
      #2 {main}
        thrown in /var/www/html/SOAP/index.php on line 12
      I already granted gmlevel 3 and activated SOAP in the worldserver.conf
       
      Is login corresponding to the Email I created ? Or to the ID like 10#1 ? Or did I missed something else ? 
      Thanks for answers and sorry for disturbing you ! 
       
      Edit : I've already checked and it keeps returning errors. 

       
×
×
  • Create New...