本文整理汇总了PHP中Zend_XmlRpc_Value类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Value类的具体用法?PHP Zend_XmlRpc_Value怎么用?PHP Zend_XmlRpc_Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_XmlRpc_Value类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: serialize
/**
* {@inheritdoc}
*/
public function serialize($method, array $params = [])
{
$toBeVisited = [&$params];
while (isset($toBeVisited[0]) && ($value =& $toBeVisited[0])) {
$type = gettype($value);
if ($type === 'array') {
// Zend converts non-zero-indexed arrays to structs
if (array_keys($value) !== range(0, count($value) - 1) && array_keys($value) == range(1, count($value))) {
$value = array_values($value);
}
foreach ($value as &$child) {
$toBeVisited[] =& $child;
}
} elseif ($type === 'object') {
if ($value instanceof \DateTime) {
$value = \Zend_XmlRpc_Value::getXmlRpcValue($value->format('Ymd\\TH:i:s'), \Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME);
} elseif ($value instanceof Base64) {
$value = \Zend_XmlRpc_Value::getXmlRpcValue($value->getDecoded(), \Zend_XmlRpc_Value::XMLRPC_TYPE_BASE64);
} else {
$value = get_object_vars($value);
}
} elseif ($type === 'resource') {
throw new InvalidTypeException($value);
}
array_shift($toBeVisited);
}
$request = new \Zend_XmlRpc_Request($method, $params);
try {
return $request->saveXml();
} catch (\Exception $e) {
throw new SerializerException($e->getMessage(), $e->getCode(), $e);
}
}
开发者ID:fxmlrpc,项目名称:serialization,代码行数:36,代码来源:Zend1Serializer.php
示例2: _mockXmlRpcClient
protected function _mockXmlRpcClient($method, $retval, $params = array())
{
$this->_xmlRpcMock = $this->getMock('Zend_XmlRpc_Client', array('setSkipSystemLookup', 'call'), array('http://foo'));
$this->_xmlRpcMock->expects($this->once())->method('setSkipSystemLookup')->with(true);
$params = array_merge($params, array('apikey' => $this->_gravatarXmlRpc->getApiKey()));
$this->_xmlRpcMock->expects($this->once())->method('call')->with('grav.' . $method, array(Zend_XmlRpc_Value::getXmlRpcValue($params, Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT)))->will($this->returnValue($retval));
$this->_gravatarXmlRpc->setXmlRpcClient($this->_xmlRpcMock);
}
开发者ID:MajideB,项目名称:np-gravatar,代码行数:8,代码来源:XmlRpcTest.php
示例3: model_saved
public function model_saved($observer)
{
$event = $observer->getEvent();
$order = $event->getOrder();
if ($this->new_order) {
$customer_id = (string) $order->getCustomerId();
if ($customer_id == '0') {
$customer_id = '';
}
$this->affiliate_call('order_placed', array(Zend_XmlRpc_Value::getXmlRpcValue($_GET, Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT), Zend_XmlRpc_Value::getXmlRpcValue($_COOKIE, Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT), (string) $order->getRealOrderId(), (string) ($order->getData('subtotal') - $order->getData('discount_amount')), $order->getData('customer_email'), $order->getCustomerName(), $customer_id));
}
if ($order->getStatus() == "complete") {
$this->affiliate_call('order_shipped', array((string) $order->getRealOrderId()));
}
return $this;
}
开发者ID:JulioNavarro,项目名称:Affiliates-For-All,代码行数:16,代码来源:Observer.php
示例4: loadXml
/**
* Load a response from an XML response
*
* Attempts to load a response from an XMLRPC response, autodetecting if it
* is a fault response.
*
* @param string $response
* @return boolean True if a valid XMLRPC response, false if a fault
* response or invalid input
*/
public function loadXml($response)
{
if (!is_string($response)) {
$this->_fault = new Zend_XmlRpc_Fault(650);
$this->_fault->setEncoding($this->getEncoding());
return false;
}
// cast to default encoding
$response = iconv('', $this->getEncoding(), $response);
try {
$xml = @new SimpleXMLElement($response);
} catch (Exception $e) {
// Not valid XML
$this->_fault = new Zend_XmlRpc_Fault(651);
$this->_fault->setEncoding($this->getEncoding());
return false;
}
if (!empty($xml->fault)) {
// fault response
$this->_fault = new Zend_XmlRpc_Fault();
$this->_fault->setEncoding($this->getEncoding());
$this->_fault->loadXml($response);
return false;
}
if (empty($xml->params)) {
// Invalid response
$this->_fault = new Zend_XmlRpc_Fault(652);
$this->_fault->setEncoding($this->getEncoding());
return false;
}
try {
$valueXml = $xml->params->param->value->asXML();
$valueXml = preg_replace('/<\\?xml version=.*?\\?>/i', '', $valueXml);
$value = Zend_XmlRpc_Value::getXmlRpcValue(trim($valueXml), Zend_XmlRpc_Value::XML_STRING);
} catch (Zend_XmlRpc_Value_Exception $e) {
$this->_fault = new Zend_XmlRpc_Fault(653);
$this->_fault->setEncoding($this->getEncoding());
return false;
}
$this->setReturnValue($value->getValue());
return true;
}
开发者ID:BackupTheBerlios,项目名称:openpublisher-svn,代码行数:52,代码来源:Response.php
示例5: saveXml
/**
* 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();
}
开发者ID:sepano,项目名称:open-social-media-monitoring,代码行数:16,代码来源:Fault.php
示例6: header
<?php
header('Content-Type: text/plain');
set_include_path(realpath('../src/ZendFramework/library'));
require_once 'Zend/Http/Client.php';
require_once 'Zend/XmlRpc/Client.php';
require_once 'Zend/XmlRpc/Request.php';
require_once 'Zend/XmlRpc/Generator/XmlWriter.php';
$generator = new Zend_XmlRpc_Generator_XmlWriter();
//require_once('Zend/XmlRpc/Generator/DomDocument.php');
//$generator = new Zend_XmlRpc_Generator_DomDocument();
Zend_XmlRpc_Value::setGenerator($generator);
$httpClient = new Zend_Http_Client();
$httpClient->setAdapter('Zend_Http_Client_Adapter_Test');
$httpClient->getAdapter()->addResponse(new Zend_Http_Response(200, array(), new Zend_XmlRpc_Response('OK')));
$client = new Zend_XmlRpc_Client('http://localhost/', $httpClient);
for ($i = 8; $i > 0; $i--) {
$client->call("test-{$i}", array('one', 'two'));
echo "memory_usage " . memory_get_usage() . " bytes \n";
}
开发者ID:Tony133,项目名称:zf-web,代码行数:20,代码来源:ZendXmlRpcClientCall.php
示例7: saveXml
/**
* 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();
}
开发者ID:hirentricore,项目名称:devmagento,代码行数:14,代码来源:Response.php
示例8: _handle
/**
* Handle an xmlrpc call (actual work)
*
* @param Zend_XmlRpc_Request $request
* @return Zend_XmlRpc_Response
* @throws Zend_XmlRpcServer_Exception|Exception
* Zend_XmlRpcServer_Exceptions are thrown for internal errors; otherwise,
* any other exception may be thrown by the callback
*/
protected function _handle(Zend_XmlRpc_Request $request)
{
$method = $request->getMethod();
// Check for valid method
if (!$this->_table->hasMethod($method)) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 620);
}
$info = $this->_table->getMethod($method);
$params = $request->getParams();
$argv = $info->getInvokeArguments();
if (0 < count($argv) and $this->sendArgumentsToAllMethods()) {
$params = array_merge($params, $argv);
}
// Check calling parameters against signatures
$matched = false;
$sigCalled = $request->getTypes();
$sigLength = count($sigCalled);
$paramsLen = count($params);
if ($sigLength < $paramsLen) {
for ($i = $sigLength; $i < $paramsLen; ++$i) {
$xmlRpcValue = Zend_XmlRpc_Value::getXmlRpcValue($params[$i]);
$sigCalled[] = $xmlRpcValue->getType();
}
}
$signatures = $info->getPrototypes();
foreach ($signatures as $signature) {
$sigParams = $signature->getParameters();
if ($sigCalled === $sigParams) {
$matched = true;
break;
}
}
if (!$matched) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Calling parameters do not match signature', 623);
}
$return = $this->_dispatch($info, $params);
$responseClass = $this->getResponseClass();
return new $responseClass($return);
}
开发者ID:nhp,项目名称:shopware-4,代码行数:56,代码来源:Server.php
示例9: saveXml
/**
* 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();
}
开发者ID:bizanto,项目名称:Hooked,代码行数:23,代码来源:Request.php
示例10: _getXmlRpcParams
/**
* Retrieve method parameters as XMLRPC values
*
* @return array
*/
protected function _getXmlRpcParams()
{
$params = array();
if (is_array($this->_xmlRpcParams)) {
foreach ($this->_xmlRpcParams as $param) {
$value = $param['value'];
$type = isset($param['type']) ? $param['type'] : Zend_XmlRpc_Value::AUTO_DETECT_TYPE;
$params[] = Zend_XmlRpc_Value::getXmlRpcValue($value, $type);
}
}
return $params;
}
开发者ID:renatosoares,项目名称:blog-zend1,代码行数:17,代码来源:Request.php
示例11: file_get_contents
require_once __DIR__ . '/../vendor/autoload.php';
$start = 0;
$limit = 40;
$r = null;
$xml = file_get_contents(__DIR__ . '/response.xml');
$start = microtime(true);
for ($a = 0; $a < $limit; ++$a) {
$s = new SimpleXmlElement($xml);
$r = Zend\XmlRpc\AbstractValue::getXmlRpcValue($s->params->param->value->asXml(), Zend\XmlRpc\AbstractValue::XML_STRING);
}
$end = microtime(true);
printf("Zend\\XmlRpc\\AbstractValue (ZF2): %s sec for %d passes\n", $end - $start, $limit);
$start = microtime(true);
for ($a = 0; $a < $limit; ++$a) {
$s = new SimpleXmlElement($xml);
$r = Zend_XmlRpc_Value::getXmlRpcValue($s->params->param->value->asXml(), Zend_XmlRpc_Value::XML_STRING);
}
$end = microtime(true);
printf("Zend_XmlRpc_Value (ZF1): %s sec for %d passes\n", $end - $start, $limit);
$start = microtime(true);
$parser = new fXmlRpc\Parser\XmlReaderParser();
for ($a = 0; $a < $limit; ++$a) {
$r = $parser->parse($xml);
}
$end = microtime(true);
printf("fXmlRpc\\Parser\\XmlReaderParser: %s sec for %d passes\n", $end - $start, $limit);
$start = microtime(true);
$parser = new fXmlRpc\Parser\NativeParser();
for ($a = 0; $a < $limit; ++$a) {
$r = $parser->parse($xml);
}
开发者ID:lstrojny,项目名称:fxmlrpc,代码行数:31,代码来源:parser.php
示例12: sendToBitcash
/**
* sendToBitcashメソッド
*
* bitcashサーバーと通信をする
* ├カード認証
* └決済実行
*
* @param array $orderingData 注文データ
* @param string $card_number カード番号(ひらがな16文字)
*
* @return array $result ビットキャッシュからの戻り値
*
*/
function sendToBitcash($orderingData, $cardNumber)
{
if (!$orderingData or !$cardNumber) {
return FALSE;
}
$ComXmlRpcClientOBJ = new ComXmlRpcClient(self::BITCASH_URL);
try {
$ComXmlRpcClientOBJ->setSkipSystemLookup(true);
$proxy = $ComXmlRpcClientOBJ->getProxy("Settlement");
/* ■■■■■■■■■
* バリデートロジック
* ■■■■■■■■■
* ビットキャッシュ側にカード、金額データを送信して
* チェックを行う。
*/
$validateParam["SHOP_ID"] = self::BITCASH_SHOP_ID;
$validateParam["SHOP_PASSWD"] = self::BITCASH_SHOP_PASS;
$validateParam["CARD_NUMBER"] = $cardNumber;
$validateParam["RATING"] = self::BITCASH_RATING;
$validateParam["PRICE"] = $orderingData["pay_total"];
$validateParam["ORDER_ID"] = $orderingData["id"];
$validateParam = Zend_XmlRpc_Value::getXmlRpcValue($validateParam, Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT);
$validateResult = $proxy->validate_card($validateParam);
if (!$validateResult) {
$this->_errorMsg = "validate_card_false_result";
return false;
} else {
if ($validateResult["faultCode"]) {
$this->_errorMsg = "validate_card_fault_code";
return false;
}
}
/* 返り値の取得
*
*
* 1.ERRORの場合 例)カード情報が違う
* Array
* ( [STATUS] => FAIL
* [ERROR] => Array( [0] => 354:bad_card_number )
* [LOG_ID] => 43634282 //バリデーション時の入出力ID
* )
*
* 2.OKの場合
* Array
* ([BALANCE] => 100000 //バリデーション実行正常終了時のクレジット数(引き落とし前のクレジット数)
* [BCS_ID] => 1581403990 //バリデーション正常終了時に発行されるセッション番号(決済実行時に使用)
* [ERROR] => Array()
* [STATUS] => OK
* [LOG_ID] => 43634465 //バリデーション時の入出力ID
* )
*/
// 有効ではない
if ($validateResult["ERROR"]) {
$this->_errorMsg = $validateResult["ERROR"][0];
return false;
}
// 有効ではない
if ("OK" != $validateResult["STATUS"]) {
$this->_errorMsg = "validate_card_bad_status";
return false;
}
/* ■■■■■■
* 決済ロジック
* ■■■■■■
* STATUSがOKで帰ってきたらまたbitcashにデータの送信。決済を行う。
*/
$param["SHOP_ID"] = self::BITCASH_SHOP_ID;
$param["SHOP_PASSWD"] = self::BITCASH_SHOP_PASS;
$param["CARD_NUMBER"] = $cardNumber;
$param["BCS_ID"] = $validateResult["BCS_ID"];
$param["PRICE"] = $orderingData["pay_total"];
$param["ORDER_ID"] = $orderingData["id"];
$param = Zend_XmlRpc_Value::getXmlRpcValue($param, Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT);
$result = $proxy->do_settlement($param);
if (!$result) {
$this->_errorMsg = "do_settlement_false_result";
return false;
} else {
if ($result["faultCode"]) {
$this->_errorMsg = "do_settlement_fault_code";
return false;
}
}
/* 返り値の取得
*
* 1.ERRORの場合 例)BCS_ID(バリデート時に生成されるID)がない場合
* Array
//.........这里部分代码省略.........
开发者ID:noriotakei,项目名称:suraimu,代码行数:101,代码来源:SettlementBitcash.php
示例13: _call
/**
* Executes XML-RPC request by proxying local XML-RPC client.
*
* @see Zend_XmlRpc_Client
* @param string $method
* @param array $params
* @return mixed
*/
protected function _call($method, $params = array())
{
$params = array_merge($params, array('apikey' => $this->getApiKey()));
$xmlRpcClient = $this->getXmlRpcClient();
$xmlRpcClient->setSkipSystemLookup(true);
//We will manually prepare params.
try {
$retval = $xmlRpcClient->call('grav.' . $method, array(Zend_XmlRpc_Value::getXmlRpcValue($params, Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT)));
return $retval;
} catch (Zend_XmlRpc_Client_FaultException $ex) {
require_once 'NP/Service/Gravatar/XmlRpc/Exception.php';
throw new NP_Service_Gravatar_XmlRpc_Exception($ex->getMessage());
}
}
开发者ID:MajideB,项目名称:np-gravatar,代码行数:22,代码来源:XmlRpc.php
示例14: _convertParams
/**
* Convert an array of PHP variables into XML-RPC native types represented by Zend_XmlRpc_Value objects
* If method name is given, try to use the _methodSignatures data member for type hinting,
* if not, auto convert the PHP variable types into XML-RPC types
*
* @param array $params Array of PHP varaibles and/or Zend_XmlRpc_Value objects
* The parameter is passed by reference
* @param string $methodName If set, the type hinting will be according to the parameters of this method
* @return array|null Array of Zend_XmlRpc_Value objects
*/
protected function _convertParams(&$params, $methodName = null)
{
if (!is_array($params)) {
$params = null;
return;
}
$paramsTypeHinting = $this->_getMethodParams($methodName);
/** @todo what we do if count($paramsTypeHinting) differ than count($params) ? maybe nothing */
foreach ($params as $i => &$param) {
if (!$param instanceof Zend_XmlRpc_Value) {
// Need to convert the parameter to Zend_XmlRpc_Value object
// If there is type hinting for this method, we use it, otherwise
// the convertion is done according to the PHP type
if (isset($paramsTypeHinting[$i])) {
$param = Zend_XmlRpc_Value::getXmlRpcValue($param, $paramsTypeHinting[$i]);
} else {
$param = Zend_XmlRpc_Value::getXmlRpcValue($param);
}
}
}
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:31,代码来源:Client.php
示例15: set_include_path
* $this->_xmlWriter->flush(true);
*/
// installed framework
set_include_path(realpath('../src/ZendFramework/library'));
// required classes
require_once 'Zend/XmlRpc/Generator/XmlWriter.php';
require_once 'Zend/XmlRpc/Value.php';
// be sure to use the leaky generator
$generator = new Zend_XmlRpc_Generator_XmlWriter();
Zend_XmlRpc_Value::setGenerator($generator);
// test a thousand times
for ($i = 1000; $i > 0; $i--) {
// make a thousand stars
$bug = str_pad('', 1000, '*');
// factorize value
$bug = Zend_XmlRpc_Value::getXmlRpcValue($bug, Zend_XmlRpc_Value::XMLRPC_TYPE_STRING);
// save value, this leaks!
$bug = $bug->saveXml();
// report sometimes
if ($i % 100 === 0) {
$mem = floor(memory_get_usage() / 1024);
echo "KB {$mem}\n";
}
// print once
if ($i === 1) {
echo htmlentities($bug);
}
// clean
unset($bug);
}
?>
开发者ID:Tony133,项目名称:zf-web,代码行数:31,代码来源:ZendXmlRpcGeneratorXmlWriterLeaks.php
示例16: testPassingXmlRpcObjectReturnsTheSameObject
public function testPassingXmlRpcObjectReturnsTheSameObject()
{
$xmlRpcValue = new Zend_XmlRpc_Value_String('foo');
$this->assertSame($xmlRpcValue, Zend_XmlRpc_Value::getXmlRpcValue($xmlRpcValue));
}
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:5,代码来源:ValueTest.php
示例17: _handle
/**
* Handle an xmlrpc call (actual work)
*
* @param Zend_XmlRpc_Request $request
* @return Zend_XmlRpc_Response
* @throws Zend_XmlRpcServer_Exception|Exception
* Zend_XmlRpcServer_Exceptions are thrown for internal errors; otherwise,
* any other exception may be thrown by the callback
*/
protected function _handle(Zend_XmlRpc_Request $request)
{
$method = $request->getMethod();
// Check for valid method
if (!isset($this->_table[$method])) {
throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 620);
}
$info = $this->_table[$method];
$params = $request->getParams();
$argv = $info->getInvokeArguments();
if (0 < count($argv)) {
$params = array_merge($params, $argv);
}
// Check calling parameters against signatures
$matched = false;
$sigCalled = array();
foreach ($params as $param) {
$value = Zend_XmlRpc_Value::getXmlRpcValue($param);
$sigCalled[] = $value->getType();
}
$signatures = $info->getPrototypes();
foreach ($signatures as $signature) {
$sigParams = $signature->getParameters();
$tmpParams = array();
foreach ($sigParams as $param) {
$tmpParams[] = $param->getType();
}
if ($sigCalled === $tmpParams) {
$matched = true;
break;
}
}
if (!$matched) {
throw new Zend_XmlRpc_Server_Exception('Calling parameters do not match signature', 623);
}
if ($info instanceof Zend_Server_Reflection_Function) {
$func = $info->getName();
$return = call_user_func_array($func, $params);
} elseif ($info instanceof Zend_Server_Reflection_Method && $info->system) {
// System methods
$return = $info->invokeArgs($this, $params);
} elseif ($info instanceof Zend_Server_Reflection_Method) {
// Get class
$class = $info->getDeclaringClass()->getName();
if ('static' == $info->isStatic()) {
// for some reason, invokeArgs() does not work the same as
// invoke(), and expects the first argument to be an object.
// So, using a callback if the method is static.
$return = call_user_func_array(array($class, $info->getName()), $params);
} else {
// Object methods
try {
$object = $info->getDeclaringClass()->newInstance();
} catch (Exception $e) {
throw new Zend_XmlRpc_Server_Exception('Error instantiating class ' . $class . ' to invoke method ' . $info->getName(), 621);
}
$return = $info->invokeArgs($object, $params);
}
} else {
throw new Zend_XmlRpc_Server_Exception('Method missing implementation ' . get_class($info), 622);
}
$response = new ReflectionClass($this->_responseClass);
return $response->newInstance($return);
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:73,代码来源:Server.php
示例18: testGetSetEncoding
/**
* 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());
}
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:11,代码来源:ServerTest.php
示例19: testFactoryThrowsWhenInvalidTypeSpecified
public function testFactoryThrowsWhenInvalidTypeSpecified()
{
try {
Zend_XmlRpc_Value::getXmlRpcValue('', 'bad type here');
$this->fail();
} catch (Exception $e) {
$this->assertRegexp('/given type is not/i', $e->getMessage());
}
}
开发者ID:jon9872,项目名称:zend-framework,代码行数:9,代码来源:ValueTest.php
示例20: saveXML
/**
* 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);
$valueDOM = new DOMDocument('1.0', $this->getEncoding());
$valueDOM->loadXML($value->saveXML());
// Build response XML
$dom = new DOMDocument('1.0', 'ISO-8859-1');
$r = $dom->appendChild($dom->createElement('methodResponse'));
$f = $r->appendChild($dom->createElement('fault'));
$f->appendChild($dom->importNode($valueDOM->documentElement, 1));
return $dom->saveXML();
}
开发者ID:Mendim,项目名称:gtv-resources,代码行数:19,代码来源:Fault.php
注:本文中的Zend_XmlRpc_Value类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论