public function rest()
 {
     $vo_restserver = new Zend_Rest_Server();
     $vo_restserver->returnResponse(true);
     $vo_restserver->setClass('UserContentService', null, array($this->request));
     $this->view->setVar("rest_server", $vo_restserver);
     $this->render("usercontent_rest.php");
 }
 public function rest()
 {
     $vo_restserver = new Zend_Rest_Server();
     $vo_restserver->returnResponse(true);
     $vo_restserver->setClass('CataloguingService', null, array($this->request));
     $this->view->setVar("rest_server", $vo_restserver);
     $this->render("cataloguing_rest.php");
 }
Ejemplo n.º 3
0
 public function batchAction()
 {
     $server = new Zend_Rest_Server();
     //$test = new Service_Batch();
     //    	$test->getSecurityKey();
     $server->setClass('Service_Batch');
     $server->handle();
     $this->render('index');
 }
 public function sintegraAction()
 {
     // Desabilitar renderização do layout e da view
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout()->disableLayout();
     // Iniciar servidor web service
     $restSrv = new Zend_Rest_Server();
     $restSrv->setClass('AutoLoad_RestServ');
     $restSrv->handle();
 }
 public function rest()
 {
     if ($this->opb_disable) {
         return "";
     }
     $vo_restserver = new Zend_Rest_Server();
     $vo_restserver->returnResponse(true);
     $vo_restserver->setClass('AccessControlService', null, array($this->request));
     $this->view->setVar("rest_server", $vo_restserver);
     $this->render("accesscontrol/accesscontrol_rest.php");
 }
Ejemplo n.º 6
0
 public function mainAction()
 {
     /**
      * Say Hello
      *
      * @param string $who
      * @param string $when
      * @return string
      */
     require_once 'Zend/Rest/Server.php';
     $server = new Zend_Rest_Server();
     try {
         $server->setClass('serviceClass');
     } catch (Zend_Exception $e) {
         echo "Caught exception: " . get_class($e) . "\n";
         echo "Message: " . $e->getMessage() . "\n";
     }
     $server->handle();
 }
Ejemplo n.º 7
0
 function testHandleNamedArgStatic()
 {
     $server = new Zend_Rest_Server();
     $server->setClass('Zend_Rest_Server_Test');
     ob_start();
     $server->handle(array('method' => 'testFunc6', 'who' => "Davey", 'when' => 'today'));
     $result = ob_get_clean();
     $this->assertEquals("<Zend_Rest_Server_Test generator='zend' version='1.0'><testFunc6><response>Hello Davey, How are you today</response><status>success</status></testFunc6></Zend_Rest_Server_Test>", $result, "Bad Result");
 }
Ejemplo n.º 8
0
 /**
  * @group ZF-3751
  */
 public function testCallingNoMethodDoesNotThrowUnknownButSpecificErrorExceptionMessage()
 {
     $server = new Zend_Rest_Server();
     $server->setClass('Zend_Rest_Server_Test2');
     $server->returnResponse(true);
     $response = $server->handle();
     $this->assertContains('<status>failed</status>', $response);
     $this->assertNotContains('<message>An unknown error occured. Please try again.</message>', $response);
 }
Ejemplo n.º 9
0
<?php

// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap();
// now create the service
$server = new Zend_Rest_Server();
$server->setClass('CMS_Api');
$server->handle();
Ejemplo n.º 10
0
 public function testReturnResponseForcesHandleToReturnResponse()
 {
     $server = new Zend_Rest_Server();
     $server->returnResponse(true);
     $server->setClass('Zend_Rest_Server_Test2');
     ob_start();
     $response = $server->handle(array('method' => 'test2Xml'));
     $result = ob_get_clean();
     $this->assertTrue(empty($result));
     $this->assertContains('<foo>bar</foo>', $response);
 }
     * returns an uppercase string
     * @param string $string
     * @return string;
     */
    public function toUpper($string)
    {
        return strtoupper($string);
    }
    /**
     * returns a lowercase string
     * @param string $string
     * @return string
     */
    public function toLower($string)
    {
        return strtolower($string);
    }
    /**
     * Makes a string awesome
     * 
     * @param string $string
     */
    public function encode($string)
    {
        return md5($string);
    }
}
require_once 'Zend/Rest/Server.php';
$server = new Zend_Rest_Server();
$server->setClass('MyService');
$server->handle();
Ejemplo n.º 12
0
<?php

ini_set("soap.wsdl_cache_enabled", 0);
include dirname(__FILE__) . '/SintegraSpider.php';
include_once 'Zend/Rest/Server.php';
class SintegraService
{
    /**
     * buscaCNPJ
     *
     * @param string $cnpj
     * @return array
     */
    function buscaCNPJ($cnpj)
    {
        try {
            $spider = new SintegraSpider();
            return $spider->consultaCNPJ($cnpj);
        } catch (Exception $e) {
            throw new SoapFault((string) $e->getCode(), $e->getMessage());
        }
    }
}
$server = new Zend_Rest_Server();
$server->setClass('SintegraService');
$server->handle();
$server = new Zend_Rest_Server();
$server->addFunction('buscaCNPJ');
$server->handle();
Ejemplo n.º 13
0
<?php

class Server
{
    /**
     * Echo simple command.
     * Takes a string as input and echoes it.
     *
     * @param string $value The string to send back to client
     * @return string
     */
    public function parrot($value)
    {
        return $value;
    }
}
require_once 'Zend/Rest/Server.php';
$server = new Zend_Rest_Server();
$server->setClass('Server');
$server->handle();
Ejemplo n.º 14
0
 public function testGeneratedXmlEncodesFaultAmpersands()
 {
     $server = new Zend_Rest_Server();
     $server->returnResponse(true);
     $server->setClass('Zend_Rest_Server_Test');
     ob_start();
     $response = $server->handle(array('method' => 'testExceptionsEncoding'));
     $result = ob_get_clean();
     $this->assertTrue(empty($result));
     $this->assertContains('testing class method exception &amp; encoding', $response);
 }
Ejemplo n.º 15
0
 /**
  * @see ZF-1949
  */
 public function testMissingArgumentsWithDefaultsShouldNotResultInFaultResponse()
 {
     $server = new Zend_Rest_Server();
     $server->setClass('Zend_Rest_Server_Test');
     ob_start();
     $server->handle(array('method' => 'testFunc7', 'arg1' => "Davey"));
     $result = ob_get_clean();
     $this->assertContains('<status>success</status>', $result, var_export($result, 1));
     $this->assertContains('<response>Hello today, How are you Davey</response>', $result, var_export($result, 1));
 }
Ejemplo n.º 16
0
 function __construct()
 {
     $server = new Zend_Rest_Server();
     $server->setClass('My_Service_Class');
     $server->handle();
 }