views:

110

answers:

1

I am trying to Build a basic app, 2 PHP files, one using Zend_Rest_Server, the other - Zend_Rest_Client.

Here is server code:

class test1 {


    public function test() {
     return "mytest";
    }


}

include_once ("common.php");

set_include_path('.' . PATH_SEPARATOR . '..\..\library/' . get_include_path());
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

$server = new Zend_Rest_Server();

$server->setClass('test1');
$server->handle();

The client code is

set_include_path('.' . PATH_SEPARATOR . '.\library/' . get_include_path());
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

$client = new Zend_Rest_Client('http://localhost/dbuilder/db/jpuzzle.php');

$client->arg("test");
echo $client->get();

When I run the client ws.php app from command line interface I get this message:

Zend_Rest_Client_Result_Exception: REST Response Error: An error occured while p arsing the REST response with simplexml. in C:\Program Files\VertrigoServ\www\li brary\Zend\Rest\Client\Result.php on line 67

What can be the reason why it doesn't run and how it can be debugged?

A: 

The actual problem was not in service, but in deprecated use of autoload.

I replaced

require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

with

require_once ‘Zend/Loader/Autoloader.php’;
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);

and got the web service working.

PHP thinker