XML schema are used in the following two cases:
Creating XML-RPC packets
First, let us look at how to retrieve the useful information from the XML schema when creating a packet. Assume that we have Plesk Client access permissions, and need to create a domain and remove some old ones. Assume that we know the version of Plesk installed on the server side, say, it is Plesk 8.0 for Linux/Unix. All this means that we better use version 126.96.36.199 of API RPC. The operations on domains for this version are described in the relevant
domain_input.xsd schema. Its graphical representation (a cut version) correlates with the body of the XML packet as follows:
XML packet body looks as follows:
Here, the requested domain operations (ADD and DEL) are nested within the DOMAIN operator element. Similarly, operations on Plesk clients would require the use of the CLIENT operator, and so on. For information on which operators supported by each API RPC version, refer to the API RPC Versions section of the API RPC Reference.
Note that starting with version 188.8.131.52, Plesk API RPC supports heterogeneous requests, i.e., the requests for operations on different Plesk objects. Such a request can look as follows:
Each group of operations is isolated within the relevant operator so that operations with similar names requested for different Plesk objects would never conflict.
Validating XML-RPC packets
Let us look at how Plesk API RPC server chooses the right XML schema(s) to validate a packet just arrived.
Plesk API RPC server is arranged as a set of agents ¨C or operators ¨C managed by the Agent Engine. Every agent is a logical block responsible for handling a certain group of commands, and the Agent Engine serves as a packet dispatcher.
In addition, Agent Engine is associated with several sets of XML API schemas. Each set relates to a certain API RPC version supported by Plesk. An entry point to each version is the
agent_input.xsd file that references all 'input' schemas of the same version.
Plesk API RPC server functions as follows. First the pure XML packet, its HTTP header peeled off, gets to Agent Engine. Agent Engine retrieves the required API RPC version from the packet header and decides which of two supported schema resolution models to apply.
Old schema resolution model
The old schema resolution algorithm is applied to incoming packets that specify API RPC version 184.108.40.206 and lower. This algorithm does not implement the validation as it is. Once Agent Engine has read the API RPC version form the packet header, the incoming packet is passed further to the relevant operator. The operator parses the packet body, forms calls to Plesk internal functions, performs these invocations, gets the result, forms the response API RPC packet, and returns it to Agent Engine.
New schema resolution model
In Plesk 8 for Linux/Unix / Plesk 7.5.6 for Windows and higher, validation takes place before the incoming packet is passed to the proper operator. The Agent Engine retrieves the API RPC version from the packet header, chooses the matching set of XML schemas, and switches to the right
agent_input.xsd schema. This schema validates the operator level of the packet, after which each operator section of the packet is validated with the proper subsequent schema.
If the packet is considered invalid, Agent Engine forms an error report and sends it back to the client. If all elements of the packet are validated successfully, Agent Engine checks whether it has all agent modules necessary for further processing and invokes them one after another.
Each agent (operator) invoked receives its operator packet section, parses it, forms calls to internal functions, and returns the result of the executed commands to Agent Engine.