request#
SOAP request and response.
- class acore_soap.request.Base[source]#
Base class for
SOAPRequestandSOAPResponse.
- class acore_soap.request.SOAPRequest(command: str, username: str = 'admin', password: str = 'admin', host: str = 'localhost', port: int = 7878)[source]#
SOAPRequestis a dataclass to represent the SOAP XML request.Usage example
# this code only works in where the worldserver is running >>> request = SOAPRequest(command=".server info") >>> response = request.send() >>> response.to_json() { "body": "<?xml version="1.0" encoding="UTF-8"?><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:AC"><SOAP-ENV:Body><ns1:executeCommandResponse><result>AzerothCore rev. 85311fa55983 2023-03-25 22:36:05 +0000 (master branch) (Unix, RelWithDebInfo, Static)
Connected players: 0. Characters in world: 0.
Connection peak: 0.
Server uptime: 54 minute(s) 3 second(s)
Update time diff: 10ms, average: 10ms.
</result></ns1:executeCommandResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>", "message": "AzerothCore rev. 85311fa55983 2023-03-25 22:36:05 +0000 (master branch) (Unix, RelWithDebInfo, Static)Connected players: 0. Characters in world: 0.Connection peak: 0.Server uptime: 54 minute(s) 3 second(s)Update time diff: 10ms, average: 10ms.", "succeeded": true }
- Parameters:
command – the command to execute.
username – the in game GM account username, default “admin”.
password – the in game GM account password, default “admin”.
host – wow world server host, default “localhost”.
port – wow world server SOAP port, default 7878.
More methods from base class:
- send() SOAPResponse[source]#
Run soap command via HTTP request. This function “has to” be run on the game server and talk to the localhost. You should NEVER open SOAP port to public!
- class acore_soap.request.SOAPResponse(body: str, message: str, succeeded: bool)[source]#
SOAPResponseis a dataclass to represent the SOAP XML response.Usage:
>>> res = SOAPResponse.parse( ... ''' ... <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope ... ...<result>Account created: test
</result>...</SOAP-ENV:Envelope> ... ''' ... ) >>> res.message Account created: test >>> res.succeeded True
- Parameters:
body – the raw SOAP XML response
message – if succeeded, it is the
<result>...</result>part. if failed, it is the<faultstring>...</faultstring>partsucceeded – a boolean flag to indicate whether the command is succeeded
More methods from base class:
- classmethod parse(body: str) SOAPResponse[source]#
Parse the SOAP XML response.
- acore_soap.request.ensure_response_succeeded(request: SOAPRequest, response: SOAPResponse, raises: bool)[source]#
Ensure the response succeeded, otherwise raise an exception.