private function _setCA(Cert &$cert, $insertMode = FALSE) { $method = "PUT"; $url = E3_PROV_URL_TRUSTSTORE . "/certs/" . rawurlencode($cert->getId()); if ($insertMode) { $method = "POST"; $url = E3_PROV_URL_TRUSTSTORE . "/certs"; } /** * Send the XML payload the the Provisioning Backend */ LoggerInterface::log(($insertMode ? "Creating" : "Updating") . " Cert: {$cert->toXML()}\nEndpoint: ({$method}) {$url}", LoggerInterface::INFO); $reply = $this->restClient->makeCall($url, $method, $cert->toXML()); $xml = simplexml_load_string($reply->getPayload()); if ($reply->getHTTPCode() === "200") { if ($insertMode) { if ($cert->getId() == NULL) { $cert->setId((string) $xml->id); } } return $cert; } else { throw new Exception(!empty($xml->error) ? $xml->error->errorText : UNDEFINED_ERROR_TEXT); } }