我有以下代码
class ReservationController extends Zend_Controller_Action
{
public function init()
{
}
public function indexAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$soap = new Zend_Rest_Server();
$soap->setClass('Someclass');
$soap->handle();
}
}和
<?php
class IndexController extends Zend_Controller_Action
{
private $_URI = "http://www.mysite.local/crm/reservation";
public function clientAction() {
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
$client = new Zend_Rest_Client($this->_URI);
echo $client->sayHello('nisanth')->get();
}
}类和方法为
<?php
class Someclass
{
/**
* Say Hello
*
* @param string $who
* @return string
*/
function sayHello($who)
{
return "Hello $who";
}
} 但是当我这么说的时候,我发现了一个错误
消息: REST响应错误: simplexml_load_string() function.simplexml-load-string:^
请帮我解决这个问题。
发布于 2010-06-23 21:46:51
听起来好像没有从REST请求返回XML响应。只有当SimpleXML不能作为参数获得有效的XML时,它才会失败。
确保REST服务器实际使用Zend_REST_Server,它将函数的返回值输出到XML中。
有关Zend_Rest_Client如何工作的更多信息:http://framework.zend.com/manual/en/zend.rest.client.html
有关Zend_Rest_Server:http://framework.zend.com/manual/en/zend.rest.server.html的更多信息
https://stackoverflow.com/questions/2965842
复制相似问题