Example #1
0
 /**
  * make it look to the component as if it is receiving  
  * a GET request for a URL with a resourceId
  */
 public function testRetrieve()
 {
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['SCRIPT_FILENAME'] = 'Orders.php';
     $_SERVER['REQUEST_URI'] = 'http://localhost/Orders.php/order1';
     $_SERVER['CONTENT_TYPE'] = 'test/plain';
     $_SERVER['PATH_INFO'] = '/order1';
     ob_start();
     SCA::initComponent("Orders.php");
     $out = ob_get_contents();
     ob_end_clean();
     $string1 = str_replace("\r", "", $out);
     $string2 = str_replace("\r", "", $this->retrieve_response);
     $this->assertEquals($string1, $string2);
 }
Example #2
0
 /**
  * make it look to the component as if it is receiving  
  * a GET request for a method invocation and check the response 
  * is correct
  */
 public function testGETForm()
 {
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['SCRIPT_FILENAME'] = 'RestRpcTestService.php';
     $_SERVER['REQUEST_URI'] = 'http://localhost/TestService.php?name=Bill';
     $_SERVER['PATH_INFO'] = ' hello';
     $_SERVER['CONTENT_TYPE'] = 'application/test';
     $_GET = array("name", "Bill");
     ob_start();
     SCA::initComponent("RestRpcTestService.php");
     $out = ob_get_contents();
     ob_end_clean();
     $string1 = str_replace("\r", "", $out);
     $string2 = str_replace("\r", "", $this->response);
     $this->assertEquals($string1, $string2);
 }
Example #3
0
 /**
  * make it look to the component as if it is receiving  
  * a request for a method invocation and check the response 
  * is correct
  */
 public function testWrapperAndProxy()
 {
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $_SERVER['SCRIPT_FILENAME'] = 'TestService.php';
     $_SERVER['REQUEST_URI'] = 'http://localhost/TestService.php';
     $_SERVER['CONTENT_TYPE'] = 'application/json-rpc';
     SCA_JsonRpcServer::$test_request = $this->request;
     SCA_JsonRpcClient::$store_test_request = true;
     SCA_JsonRpcClient::$test_response = $this->email_response;
     ob_start();
     SCA::initComponent("TestService.php");
     $out = ob_get_contents();
     ob_end_clean();
     $this->assertContains($this->response, $out);
     $this->assertContains(SCA_JsonRpcClient::$test_request, $this->email_request);
 }
Example #4
0
<?php

require_once "SCA/SCA.php";
SCA::initComponent(__FILE__);
/**
 * @service
 * @binding.soap
 * @types http://www.test.com/info person.xsd (comment)
 */
class Component
{
    /**
     * Reverse a string
     *
     * @param string $in (comment)
     * @return string (comment)
     */
    function reverse($in)
    {
        return strrev($in);
    }
    /**
     * clone a phone object in under a person object
     *
     * @param person $person http://www.test.com/info (comment)
     * @param phone $phone http://www.test.com/info (comment)
     * @return person http://www.test.com/info (comment)
     */
    function add($person, $phone)
    {
        $new_phone = $person->createDataObject('phone');
Example #5
0
File: SCA.php Project: psagi/sdo
 /**
  * This function can be called directly by a php script to dispatch a request to
  * an SCA service. You only need to use this operation when you organize your
  * code so that the service implementation (and SCA/SCA.php include) are included
  * by in a script that is just a wrapper script and is not acting as a client for
  * the service. This can happen if you want keep php files that define service
  * outside of the htdocs directory
  *
  * @param string $class_name The class_name that implements the target service
  *
  * @return void
  */
 public static function dispatch($class_name)
 {
     $file_name = SCA_Helper::getFileContainingClass($class_name);
     $_SERVER['SCRIPT_FILENAME'] = $file_name;
     SCA::initComponent($file_name);
 }
Example #6
0
File: MSTest.php Project: psagi/sdo
 public function testWrapperAndProxy()
 {
     $binding_config = array('wsdl' => dirname(__FILE__) . '/MS_TestServiceSDO_wsdl', 'replyto' => 'queue://testResponse');
     $ms_service = SCA::getService(dirname(__FILE__) . '/MS_TestServiceSDO_msd', "message", $binding_config);
     $namesSDO = $ms_service->createDataObject('http://example.org/names', 'people');
     // Populate the names
     $namesSDO->name[] = 'Cathy';
     $namesSDO->name[] = 'Bertie';
     $namesSDO->name[] = 'Fred';
     /*proxy send request*/
     $ms_service->setWaitResponseTimeout(-1);
     $ms_service->greetEveryone('hello', $namesSDO);
     /*warpper get request, process it, and send response */
     ob_start();
     SCA::initComponent("MS_TestServiceSDO.php");
     ob_end_clean();
     /*proxy get response*/
     $ms_service->setWaitResponseTimeout(0);
     $sdo = $ms_service->greetEveryone('hello', $namesSDO);
     $this->assertEquals('people', $sdo->getTypename());
     $this->assertEquals(3, sizeof($sdo->name));
 }