/**
  * Writes a request object to the stream
  *
  * @param eppRequest $content
  * @return boolean
  * @throws eppException
  */
 public function writeRequest(eppRequest $content)
 {
     //$requestsessionid = $content->getSessionId();
     $namespaces = $this->getDefaultNamespaces();
     if (is_array($namespaces)) {
         foreach ($namespaces as $id => $namespace) {
             $content->addExtension($id, $namespace);
         }
     }
     /*
      * $content->login is only set if this is an instance or a sub-instance of an eppLoginRequest
      */
     if ($content->login) {
         /* @var $content eppLoginRequest */
         // Set username for login request
         $content->addUsername($this->getUsername());
         // Set password for login request
         $content->addPassword($this->getPassword());
         // Set 'new password' for login request
         if ($this->getNewPassword()) {
             $content->addNewPassword($this->getNewPassword());
         }
         // Add version to this object
         $content->addVersion($this->getVersion());
         // Add language to this object
         $content->addLanguage($this->getLanguage());
         // Add services and extensions to this content
         $content->addServices($this->getServices(), $this->getExtensions());
     }
     /*
      * $content->hello is only set if this is an instance or a sub-instance of an eppHelloRequest
      */
     if (!$content->hello) {
         /**
          * Add used namespaces to the correct places in the XML
          */
         $content->addNamespaces($this->getServices());
         $content->addNamespaces($this->getExtensions());
     }
     $content->formatOutput = false;
     if ($this->write($content->saveXML(null, LIBXML_NOEMPTYTAG))) {
         return true;
     } else {
         return false;
     }
 }