开发者

Zend Rest Client issue

i have the codes below

class ReservationController extends Zend_Controller_Action
{
    public function init()
    {
    }

    public function indexAction()
    {
        $this->_helper->viewRenderer->setNoRender();
        $this->_helper-&开发者_运维技巧gt;layout->disableLayout();

        $soap = new Zend_Rest_Server();
        $soap->setClass('Someclass');

        $soap->handle();
    }
}

and

<?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();

    }

}

and the class and method as

<?php
class Someclass
{
/**
* Say Hello
*
* @param string $who
* @return string
*/
function sayHello($who)
{
    return "Hello $who";

}
} 

but while calling this i got an error

Message: REST Response Error: simplexml_load_string() [function.simplexml-load-string]: ^

pls help me to solve this issue


Sounds like you're not returning an XML response from your REST request. SimpleXML only fails when it doesn't get valid XML as a parameter.

Make sure that your REST server is actually employing Zend_REST_Server, which outputs the return value of a function into an XML response.

For more info on how Zend_Rest_Client works: http://framework.zend.com/manual/en/zend.rest.client.html

For more info on Zend_Rest_Server: http://framework.zend.com/manual/en/zend.rest.server.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜