Конфигурация автомобиля CLASS (папка библиотеки)
class vehicleConfiguration {
public $Year;
public $Make;
public $Model;
public $Engine;
public $Transmission;
public $Mileage;
public $VehicleCondition;
public function __construct()
{
// parent::__construct();
$this->Year = (object) array();
$this->Make = (object) array();
$this->Model = (object) array();
$this->Engine = (object) array();
$this->Transmission = (object) array();
$this->Mileage = (object) array('Mileage' => '');
$this->VehicleCondition = (object) array('VehicleCondition' => '');
}
function Mileage($mileage)
{
$this->Mileage = $mileage;
}
function VehicleCondition($mileage)
{
$this->VehicleCondition = $mileage;
}
}
CLASS IdNamePair (папка библиотеки)
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class IdNamePair {
public function __construct()
{
// parent::__construct();
}
function IdNamePair($id, $name)
{
$this->Id = $id;
$this->Name = $name;
}
}
Запрос класса (Контроллер)
$this->load->library('vehicleConfiguration');
$this->load->library('IdNamePair');
$soap_connect = new SoapClient('http://sample.idws.syndication.kbb.com/VehicleInformationService2008R2.svc?wsdl', array('trace' => 1));
$trim = $this->input->post('car_id'); //trim ID
$consumer_category = 'Consumer'; //Consumer, Dealer
$key = $this->input->post('Key');
$var_date = strtotime($this->input->post('Ver_date'));
$car_type = $this->input->post('Type');
$stateAbbrev= "CA";
$get_car_value->authenticationKey = $key;
$get_car_value->versionDate = $var_date;
$get_car_value->stateAbbreviation = $stateAbbrev;
$config = $this->vehicleconfiguration;
$config->Year = $this->idnamepair;
$config->Make = $this->idnamepair;
$config->Model = $this->idnamepair;
$config->Trim = $this->idnamepair;
$config->Engine = $this->idnamepair;
$config->Transmission = $this->idnamepair;
$config->Year->IdNamePair($this->input->post('year'),$this->input->post('year')) ;
$config->Make->IdNamePair($this->input->post('make'),$this->input->post('make')) ;
$config->Model->IdNamePair($this->input->post('model'),$this->input->post('model')) ;
$config->Trim->IdNamePair($this->input->post('car_id'),$this->input->post('car_id')) ;
$config->Engine->IdNamePair($this->input->post('engine'),$this->input->post('engine')) ;
$config->Transmission->IdNamePair($this->input->post('trans'),$this->input->post('trans')) ;
$config->Mileage = $this->input->post('mileage');
$config->VehicleCondition = 'Excellent';
$params = array(
'authenticationKey' => $key,
'versionDate' => $var_date,
'stateAbbreviation' => $stateAbbrev,
'Id' => $this->input->post('car_id'),
$config
);
$result = $soap_connect->__soapCall('GetVehicleValuesByVehicleConfiguration', array($params));