Class for handling the XML API requests.
The user should derive from this class and implement the methods with the names of the API actions.
URL: http://smartfactorydev.loc/api/get_rooms/
Action: get_rooms
function get_rooms()
{
$xsdpath = new \DOMXPath($this->request_xmldoc);
$nodes = $xsdpath->evaluate("/Request/City");
if ($nodes->length == 0) {
throw new SmartException("City is undefined!", "no_city");
}
$city = $nodes->item(0)->nodeValue;
$response = $this->response_xmldoc->createElement("Response");
$this->response_xmldoc->appendChild($response);
...
} // get_rooms
| Properties | |
|---|---|
|
protected
|
Internal variable for storing the request XML document. |
|
protected
|
Internal variable for storing the response XML document. |
| Methods | |
|---|---|
|
public
|
Constructor. |
|
protected
|
This is an auxiliary function for parsing the incoming XML data. |
|
protected
|
This is an auxiliary function for sending the response in XML format. |
Internal variable for storing the request XML document.
Internal variable for storing the response XML document.
Constructor.
It initializes the XML document variables.
This is an auxiliary function for parsing the incoming XML data.
It validates the content type 'application/xml' and takes the data from RAWDATA.
It might throw an exception if the content type oк XML data is invalid.
This is an auxiliary function for sending the response in XML format.
It sends the prepared response XML document and the response headers. The header "Content-type: application/xml" ist sent automatically.