Source for file jResponseXmlrpc.class.php

Documentation is available at jResponseXmlrpc.class.php

  1. <?php
  2. /**
  3. * @package     jelix
  4. * @subpackage  core_response
  5. * @author      Laurent Jouanneau
  6. * @copyright   2005-2010 Laurent Jouanneau
  7. * @link        http://www.jelix.org
  8. * @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
  9. */
  10.  
  11.  
  12. /**
  13. * xmlrpc response
  14. * @package  jelix
  15. * @subpackage core_response
  16. * @see jResponse
  17. */
  18. final class jResponseXmlRpc extends jResponse {
  19.     /**
  20.     * @var string 
  21.     */
  22.     protected $_type = 'xmlrpc';
  23.  
  24.     /**
  25.      * PHP Data to send into the response
  26.      */
  27.     public $response = null;
  28.  
  29.     public function output(){
  30.  
  31.         $content = jXmlRpc::encodeResponse($this->response, $GLOBALS['gJConfig']->charset);
  32.  
  33.         $this->_httpHeaders["Content-Type"]="text/xml;charset=".$GLOBALS['gJConfig']->charset;
  34.         $this->_httpHeaders["Content-length"]=strlen($content);
  35.         $this->sendHttpHeaders();
  36.         echo $content;
  37.         return true;
  38.     }
  39.  
  40.     public function outputErrors(){
  41.         global $gJCoord, $gJConfig;
  42.  
  43.         $errorMessage = $gJCoord->getGenericErrorMessage();
  44.         $e = $gJCoord->getErrorMessage();
  45.         if ($e) {
  46.             $errorCode = $e->getCode();
  47.         }
  48.         else {
  49.             $errorCode = -1;
  50.         }
  51.  
  52.         $this->clearHttpHeaders();
  53.         $content = jXmlRpc::encodeFaultResponse($errorCode, $errorMessage, $gJConfig->charset);
  54.  
  55.         header("HTTP/1.0 500 Internal Server Error");
  56.         header("Content-Type: text/xml;charset=".$gJConfig->charset);
  57.         header("Content-length: ".strlen($content));
  58.         echo $content;
  59.     }
  60. }

Documentation generated on Mon, 19 Sep 2011 14:13:30 +0200 by phpDocumentor 1.4.3