serviceLocator); \Utility\Registry::addDynamicConfig( \Utility\Cache::fetchEntity( 'Config\Entity\Config', 1, \Utility\Registry::getEntityManager(), 600 ) ); $server = new \Zend\XmlRpc\Server(); $server->setClass('Valuation\Service\XmlRpc'); echo $server->handle(); $response = $this->getResponse(); $response->setStatusCode(200); return $response; } public function callbackAction() { if (IS_LIVE_ENV) { return; } ini_set('memory_limit','512M'); \Utility\Registry::setServiceManager($this->serviceLocator); \Utility\Registry::addDynamicConfig( \Utility\Cache::fetchEntity( 'Config\Entity\Config', 1, \Utility\Registry::getEntityManager(), 600 ) ); try { $server = new \Zend\XmlRpc\Server(); $server->setClass('Valuation\Service\XmlRpcCallback'); echo $server->handle(); $response = $this->getResponse(); $response->setStatusCode(200); } catch (\Exception $e) { error_log("$e"); } return $response; } public function xmlRpcClientAction() { if (IS_LIVE_ENV) { return; } ini_set('memory_limit','512M'); try { $url = IS_DEV_ENV ? 'http://namibia.local/xmlrpc/1.0' : 'http://bid4cars.com.na/xmlrpc/1.0'; $client = new \Zend\XmlRpc\Client($url); //$client = new \Zend\XmlRpc\Client($url . '/callback'); $arg1 = '4afb4a290f971186654f18dd6a13a7d7'; $arg2 = 'Kia123'; $authToken = $client->call('Authenticate', array($arg1, $arg2)); /* $arg1 = 'b@imperial.com'; $arg2 = array('freakin' => 'moo'); var_dump($client->call('SentToSales', array($arg1, $arg2))); */ //$authToken = '80f6de496cac332ab704a52bd427bab4'; $email = 'a@b.com'; $valuation = array( 'ItemId' => '123qweasdzxc!QAZ', 'CustomerName' => 'Qwerty i10', 'CustomerSurname' => 'Poiuytre', 'CustomerMobile' => '27112223333', 'Km' => 456, 'VehicleYearId' => 41, 'VehicleTypeId' => 6085, 'VehicleFuelTypeId' => 2, 'VehicleTransmissionTypeId' => 2, 'RegistrationNumber' => 'SomeRegNr', 'VehiclePhoto1URL' => 'http://bid4cars.nirph.com/img/bin/235785.jpg', 'VehiclePhoto2URL' => 'http://bid4cars.nirph.com/img/bin/235786.jpg', 'Damages' => array( array('VehicleComponentId' => 1, 'Amount' => 2000), array('VehicleComponentId' => 3, 'Amount' => 2500) ), 'Accessories' => array( array('VehicleAccessoryId' => 2), array('VehicleAccessoryId' => 3), array('VehicleAccessoryId' => 4) ) ); echo '
';
			var_dump($client->call('CreateValuation', array($authToken, $email, $valuation)));
			echo '
'; } catch (\Zend\XmlRpc\Client\Exception\HttpException $e) { echo $e->getCode() . ":" . $e->getMessage(); } // Disabling view $response = $this->getResponse(); $response->setStatusCode(200); return $response; } public function triggerSentToSalesAction() { \Utility\Registry::setServiceManager($this->serviceLocator); \Utility\Registry::addDynamicConfig( \Utility\Cache::fetchEntity( 'Config\Entity\Config', 1, \Utility\Registry::getEntityManager(), 600 ) ); $service = new \Valuation\Service\XmlRpcCallback(); $valuationId = $this->getRequest()->getParam('valuationId'); $service->triggerSentToSales($valuationId); return "\n"; } public function retryCallbacksAction() { \Utility\Registry::setServiceManager($this->serviceLocator); \Utility\Registry::addDynamicConfig( \Utility\Cache::fetchEntity( 'Config\Entity\Config', 1, \Utility\Registry::getEntityManager(), 600 ) ); $service = new \Valuation\Service\XmlRpcCallback(); $service->retryCallbacks(); return "\n"; } }