Ejemplo n.º 1
0
 public function testChangingExceptionResetsGeneratorObject()
 {
     $generator = Zend_XmlRpc_Value::getGenerator();
     Zend_XmlRpc_Value::setEncoding('UTF-8');
     $this->assertNotSame($generator, Zend_XmlRpc_Value::getGenerator());
     $this->assertEquals($generator, Zend_XmlRpc_Value::getGenerator());
     $generator = Zend_XmlRpc_Value::getGenerator();
     Zend_XmlRpc_Value::setEncoding('ISO-8859-1');
     $this->assertNotSame($generator, Zend_XmlRpc_Value::getGenerator());
     $this->assertNotEquals($generator, Zend_XmlRpc_Value::getGenerator());
 }
Ejemplo n.º 2
0
 /**
  * Return response as XML
  *
  * @return string
  */
 public function saveXml()
 {
     $value = $this->_getXmlRpcReturn();
     $generator = Zend_XmlRpc_Value::getGenerator();
     $generator->openElement('methodResponse')->openElement('params')->openElement('param');
     $value->generateXml();
     $generator->closeElement('param')->closeElement('params')->closeElement('methodResponse');
     return $generator->flush();
 }
Ejemplo n.º 3
0
 /**
  * Test get/setEncoding()
  */
 public function testGetSetEncoding()
 {
     $this->assertEquals('UTF-8', $this->_server->getEncoding());
     $this->assertEquals('UTF-8', Zend_XmlRpc_Value::getGenerator()->getEncoding());
     $this->assertSame($this->_server, $this->_server->setEncoding('ISO-8859-1'));
     $this->assertEquals('ISO-8859-1', $this->_server->getEncoding());
     $this->assertEquals('ISO-8859-1', Zend_XmlRpc_Value::getGenerator()->getEncoding());
 }
Ejemplo n.º 4
0
 /**
  * Create XML request
  *
  * @return string
  */
 public function saveXml()
 {
     $args = $this->_getXmlRpcParams();
     $method = $this->getMethod();
     $generator = Zend_XmlRpc_Value::getGenerator();
     $generator->openElement('methodCall')->openElement('methodName', $method)->closeElement('methodName');
     if (is_array($args) && count($args)) {
         $generator->openElement('params');
         foreach ($args as $arg) {
             $generator->openElement('param');
             $arg->generateXml();
             $generator->closeElement('param');
         }
         $generator->closeElement('params');
     }
     $generator->closeElement('methodCall');
     return $generator->flush();
 }
Ejemplo n.º 5
0
 /**
  * Serialize fault to XML
  *
  * @return string
  */
 public function saveXml()
 {
     // Create fault value
     $faultStruct = array('faultCode' => $this->getCode(), 'faultString' => $this->getMessage());
     $value = Zend_XmlRpc_Value::getXmlRpcValue($faultStruct);
     $generator = Zend_XmlRpc_Value::getGenerator();
     $generator->openElement('methodResponse')->openElement('fault');
     $value->generateXml();
     $generator->closeElement('fault')->closeElement('methodResponse');
     return $generator->flush();
 }