Exemple #1
0
 /**
  * Override __toString() to send HTTP Content-Type header
  * 
  * @return string
  */
 public function __toString()
 {
     if (!headers_sent()) {
         header('Content-Type: application/xml; charset=utf-8');
     }
     return parent::__toString();
 }
Exemple #2
0
 /**
  * Override __toString() to send HTTP Content-Type header
  *
  * @return string
  */
 public function __toString()
 {
     if (!headers_sent()) {
         header('Content-Type: text/xml; charset=' . strtolower($this->getEncoding()));
     }
     return parent::__toString();
 }
 /**
  * __toString() test
  *
  * Call as method call 
  *
  * Returns: string 
  */
 public function test__toString()
 {
     $this->_response->setReturnValue('return value');
     $xml = $this->_response->__toString();
     try {
         $sx = new SimpleXMLElement($xml);
     } catch (Exception $e) {
         $this->fail('Invalid XML returned');
     }
     $this->assertTrue($sx->params ? true : false);
     $this->assertTrue($sx->params->param ? true : false);
     $this->assertTrue($sx->params->param->value ? true : false);
     $this->assertTrue($sx->params->param->value->string ? true : false);
     $this->assertEquals('return value', (string) $sx->params->param->value->string);
 }
 /**
  * __toString() test
  */
 public function test__toString()
 {
     $this->_response->setReturnValue('return value');
     $xml = $this->_response->__toString();
     $this->_testXmlResponse($xml);
 }
 public function getServerResponseFor($nativeVars)
 {
     $response = new Zend_XmlRpc_Response();
     $response->setReturnValue($nativeVars);
     $xml = $response->__toString();
     $response = $this->makeHttpResponseFrom($xml);
     return $response;
 }