/**
  * Renders the request as XML
  *
  * @param Request &$request
  * @return string The full XML request
  */
 private function _renderRequest(CPS_Request &$request)
 {
     $envelopeFields = array('storage' => $this->_storageName, 'user' => $this->_username, 'password' => $this->_password, 'command' => $request->getCommand());
     if (count($this->_customEnvelopeParams) > 0) {
         foreach ($this->_customEnvelopeParams as $key => $val) {
             $envelopeFields[$key] = $val;
         }
     }
     if (strlen($request->getRequestId()) > 0) {
         $envelopeFields['requestid'] = $request->getRequestId();
     }
     if (strlen($this->_applicationId) > 0) {
         $envelopeFields['application'] = $this->_applicationId;
     }
     if (!is_null($reqType = $request->getRequestType())) {
         $envelopeFields['type'] = $reqType;
     }
     if (strlen($reqLabel = $request->getClusterLabel())) {
         $envelopeFields['label'] = $reqLabel;
     }
     return $request->getRequestXml($this->_documentRootXpath, $this->_documentIdXpath, $envelopeFields, $this->_resetDocIds);
 }