当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Amf_Request::setObjectEncoding方法代码示例

本文整理汇总了PHP中Zend_Amf_Request::setObjectEncoding方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Amf_Request::setObjectEncoding方法的具体用法?PHP Zend_Amf_Request::setObjectEncoding怎么用?PHP Zend_Amf_Request::setObjectEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Amf_Request的用法示例。


在下文中一共展示了Zend_Amf_Request::setObjectEncoding方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _callService

 protected function _callService($method, $class = 'Zend_Amf_Resource_testclass')
 {
     $request = new Zend_Amf_Request();
     $request->setObjectEncoding(0x3);
     $this->_server->setClass($class);
     $newBody = new Zend_Amf_Value_MessageBody("{$class}.{$method}", "/1", array("test"));
     $request->addAmfBody($newBody);
     $this->_server->handle($request);
     $response = $this->_server->getResponse();
     return $response;
 }
开发者ID:omusico,项目名称:logica,代码行数:11,代码来源:ResourceTest.php

示例2: testPHPNullSerializedToAmf0Null

 public function testPHPNullSerializedToAmf0Null()
 {
     $data = null;
     $newBody = new Zend_Amf_Value_MessageBody('/1/onResult', null, $data);
     $this->_response->setObjectEncoding(0x0);
     $this->_response->addAmfBody($newBody);
     $this->_response->finalize();
     $testResponse = $this->_response->getResponse();
     // Load the expected response.
     $mockResponse = file_get_contents(dirname(__FILE__) . '/Response/mock/nullAmf0Response.bin');
     // Check that the response matches the expected serialized value
     $this->assertEquals($mockResponse, $testResponse);
 }
开发者ID:travisj,项目名称:zf,代码行数:13,代码来源:ResponseTest.php

示例3: testCtorExcection

 public function testCtorExcection()
 {
     $this->_server->setClass('Zend_Amf_testException');
     $this->_server->setProduction(false);
     $message = new Zend_Amf_Value_Messaging_RemotingMessage();
     $message->operation = 'hello';
     $message->source = 'Zend_Amf_testException';
     $message->body = array("123");
     // create a mock message body to place th remoting message inside
     $newBody = new Zend_Amf_Value_MessageBody(null, "/1", $message);
     $request = new Zend_Amf_Request();
     // at the requested service to a request
     $request->addAmfBody($newBody);
     $request->setObjectEncoding(0x3);
     // let the server handle mock request
     $this->_server->handle($request);
     $response = $this->_server->getResponse()->getAMFBodies();
     $this->assertTrue($response[0]->getData() instanceof Zend_Amf_Value_Messaging_ErrorMessage);
     $this->assertContains("Oops, exception!", $response[0]->getData()->faultString);
 }
开发者ID:nbcutech,项目名称:o3drupal,代码行数:20,代码来源:ServerTest.php

示例4: testServerShouldCastObjectArgumentsToAppropriateType

 /**
  * @group ZF-6130
  */
 public function testServerShouldCastObjectArgumentsToAppropriateType()
 {
     $server = new Zend_Amf_Server();
     $server->addDirectory(dirname(__FILE__) . '/_files/zf-6130/services');
     // Create a mock message
     $message = new Zend_Amf_Value_Messaging_RemotingMessage();
     $message->operation = 'createEmployee';
     $message->source = 'EmployeeService';
     // original raw request used "destination"
     $message->body = array(array('office' => 322, 'departmentid' => 3, 'street' => 32, 'zipcode' => 32, 'state' => 32, 'lastname' => 4, 'firstname' => 2, 'photofile' => 322, 'city' => 32, 'id' => 1, 'title' => 4, 'officephone' => 233, 'email' => 32, 'cellphone' => 22));
     $body = new Zend_Amf_Value_MessageBody(null, "", $message);
     $request = new Zend_Amf_Request();
     $request->addAmfBody($body);
     $request->setObjectEncoding(0x3);
     $response = $server->handle($request);
     $employee = EmployeeService::$employee;
     $this->assertNotNull($employee);
     $this->assertNotEquals(1, $employee->id);
     $this->assertRegexp('/[a-z0-9]{3,}/', $employee->id);
 }
开发者ID:Notan,项目名称:awery_zend_amf,代码行数:23,代码来源:ServerTest.php

示例5: testLogout

 public function testLogout()
 {
     Zend_Session::$_unitTestEnabled = true;
     $this->_server->setAuth(new RightPassword("testuser", "testrole"));
     $this->_acl->addRole(new Zend_Acl_Role("testrole"));
     $this->_acl->allow("testrole", null, null);
     $this->_server->setAcl($this->_acl);
     $resp = $this->_callServiceAuth("testuser", "");
     $this->assertTrue($resp[0]->getData() instanceof Zend_Amf_Value_Messaging_AcknowledgeMessage);
     $this->assertContains("hello", $resp[1]->getData());
     // After logout same request should not be allowed
     $this->setUp();
     $this->_server->setAuth(new RightPassword("testuser", "testrole"));
     $this->_server->setAcl($this->_acl);
     $request = new Zend_Amf_Request();
     $request->setObjectEncoding(0x3);
     $this->_addLogout($request);
     $this->_addServiceCall($request);
     $this->_server->handle($request);
     $resp = $this->_server->getResponse()->getAmfBodies();
     $this->assertTrue($resp[0]->getData() instanceof Zend_Amf_Value_Messaging_AcknowledgeMessage);
     $data = $resp[1]->getData();
     $this->assertTrue($data instanceof Zend_Amf_Value_Messaging_ErrorMessage);
     $this->assertContains("not allowed", $data->faultString);
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:25,代码来源:AuthTest.php

示例6: getAMFResponse

 /**
  * Handles passing a request through the amf client
  * @param {string} $servicePath Service path i.e ServerController.connect
  * @param {object|array} $data Data to be sent with the request should be an array or an object
  * @return {array} Server response
  */
 protected function getAMFResponse($servicePath, $data = null)
 {
     require_once 'Zend/Amf/Request.php';
     require_once 'Zend/Amf/Constants.php';
     require_once 'Zend/Amf/Value/MessageBody.php';
     require_once 'Zend/Amf/Value/Messaging/RemotingMessage.php';
     require_once 'Zend/Amf/Value/Messaging/ErrorMessage.php';
     if ($data) {
         if (is_array($data)) {
             $data = $this->arrayToObject($data);
         } else {
             if (!is_object($data)) {
                 user_error('$data is not an array or object', E_USER_ERROR);
             }
         }
     }
     //Find the method and service
     $service = explode('.', $servicePath);
     $method = array_pop($service);
     $service = implode('.', $service);
     //Build the message
     $message = new Zend_Amf_Value_Messaging_RemotingMessage();
     $message->parameters = $data;
     $message->operation = $method;
     $message->source = $service;
     //Build the message body
     $body = new Zend_Amf_Value_MessageBody($servicePath, '/1', array($data));
     //Build the AMF Request
     $request = new Zend_Amf_Request();
     $request->addAmfBody($body);
     $request->setObjectEncoding(Zend_Amf_Constants::AMF3_OBJECT_ENCODING);
     //Init the client api
     $amfClient = new CodeBank_ClientAPI();
     $amfClient->setTestRequest($request);
     //Capture the response as an amf input stream
     ob_start();
     $response = $amfClient->index();
     ob_end_clean();
     //Get the amf bodies
     $bodies = $response->getAmfBodies();
     if (count($bodies) > 0) {
         $body = $bodies[0]->getData();
         if ($body instanceof Zend_Amf_Value_Messaging_ErrorMessage) {
             $this->fail('AMF Server returned an error: ' . $body->faultString . "\n\n" . $body->faultDetail);
             return false;
         }
         return $body;
     }
     return false;
 }
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-codebank,代码行数:56,代码来源:CodeBankAPITest.php


注:本文中的Zend_Amf_Request::setObjectEncoding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。