Example #1
0
 public function communicate()
 {
     if (empty($this->sessionId)) {
         throw new Exception('Nenhum sessionId foi definido', 500);
     }
     if (empty($this->zonename)) {
         throw new Exception('Nenhum dominio foi definido', 500);
     }
     if (empty($this->key)) {
         throw new Exception('Nenhuma chave foi definido', 500);
     }
     if (empty($this->newKeyStatus)) {
         $this->newKeyStatus = DnskeyStatus::getType('SIGN');
     }
     if (empty($this->oldKeyStatus)) {
         $this->oldKeyStatus = DnskeyStatus::getType('PUBLISH');
     }
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="UTF-8"?>
             <dnsshim version="1.0">
                 <request>
                     <changeKeyStatus>
                         <sessionId>' . $this->sessionId . '</sessionId>
                         <zone>' . $this->zonename . '</zone>
                         <key>
                             <keyName>' . $this->key . '</keyName>
                             <oldStatus>' . $this->oldKeyStatus . '</oldStatus>
                             <newStatus>' . $this->newKeyStatus . '</newStatus>
                         </key>
                     </changeKeyStatus>
                 </request>
             </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response'];
     }
 }
Example #2
0
 public function communicate()
 {
     if (empty($this->sessionId)) {
         throw new Exception('Nenhum sessionId foi definido', 500);
     }
     if (empty($this->zonename)) {
         throw new Exception('Nenhum dominio foi definido', 500);
     }
     if (empty($this->keyStatus)) {
         $this->keyStatus = DnskeyStatus::getType('SIGN');
     }
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="UTF-8"?>
             <dnsshim version="1.0">
                 <request>
                     <importKey>
                         <sessionId>' . $this->sessionId . '</sessionId>
                         <zone>' . $this->zonename . '</zone>
                         <flags>' . $this->flags . '</flags>
                         <type>' . $this->keyType . '</type>
                         <status>' . $this->keyStatus . '</status>
                         <algorithm>' . $this->algorithm . '</algorithm>
                         <modulus>' . $this->modulus . '</modulus>
                         <publicExponent>' . $this->publicExponent . '</publicExponent>
                         <privateExponent>' . $this->privateExponent . '</privateExponent>
                         <prime1>' . $this->prime1 . '</prime1>
                         <prime2>' . $this->prime2 . '</prime2>
                         <exponent1>' . $this->exponent1 . '</exponent1>
                         <exponent2>' . $this->exponent2 . '</exponent2>
                         <coefficient>' . $this->coefficient . '</coefficient>
                     </importKey>
                 </request>
             </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response'];
     }
 }