/** * @ignore * @param Soap $soap * @throws TurnitinSDKException */ public function __construct($soap) { $this->domobject = new DomDocument(); $this->requestdomobject = new DomDocument(); $logger = new TurnitinLogger($soap->getLogPath()); if ($logger) { $logger->logInfo($soap->getHttpHeaders() . PHP_EOL . $soap->__getLastRequest()); } if ($soap->getDebug()) { $this->outputDebug($soap->__getLastRequest(), 'Request Message', $soap->getHttpHeaders()); } @$this->requestdomobject->loadXML($soap->__getLastRequest()); if ($logger) { $logger->logInfo($soap->__getLastResponse()); } if ($soap->getDebug()) { $this->outputDebug($soap->__getLastResponse(), 'Response Message'); } if (($load = @$this->domobject->loadXML($soap->__getLastResponse())) === false) { throw new TurnitinSDKException('responsexmlerror', 'XML Response could not be parsed', $soap->getLogPath()); } $this->setMessageId(@$this->domobject->getElementsByTagName('imsx_messageIdentifier')->item(0)->nodeValue); $this->setStatus(@$this->domobject->getElementsByTagName('imsx_severity')->item(0)->nodeValue); if (is_null($this->getStatus())) { $this->setStatus($this->domobject->getElementsByTagName('status')->item(0)->nodeValue); } if (isset($this->domobject->getElementsByTagName('imsx_codeMinorFieldValue')->item(0)->nodeValue)) { $this->setStatusCode(@$this->domobject->getElementsByTagName('imsx_codeMinorFieldValue')->item(0)->nodeValue); } else { $this->setStatus('status'); $this->setStatusCode($this->domobject->getElementsByTagName('status')->item(0)->nodeValue); } $this->setDescription(@$this->domobject->getElementsByTagName('imsx_description')->item(0)->nodeValue); if (is_null($this->getDescription())) { $this->setDescription($this->domobject->getElementsByTagName('message')->item(0)->nodeValue); } $this->setMessageRefId(@$this->domobject->getElementsByTagName('imsx_messageRefIdentifier')->item(0)->nodeValue); }