为SOAP php将对象从c#转换为php

为SOAP php将对象从c#转换为php,c#,php,codeigniter,C#,Php,Codeigniter,我无法为我请求的某个方法获取正确的参数。 他们给了我一个关于如何实现它的c#示例代码 DateTime versionDate = Convert.ToDateTime("01/01/2008"); string stateAbbreviation = "CA"; string AuthenticationKey = “MzU=”; VehicleConfiguration vehicleConfiguration = new VehicleConfiguration(); vehicleCo

我无法为我请求的某个方法获取正确的参数。 他们给了我一个关于如何实现它的c#示例代码

DateTime versionDate = Convert.ToDateTime("01/01/2008");
string stateAbbreviation = "CA";
string AuthenticationKey = “MzU=”;

VehicleConfiguration vehicleConfiguration = new VehicleConfiguration();
vehicleConfiguration.Year = new IdNamePair();
vehicleConfiguration.Year.Id = 2005;
vehicleConfiguration.Year.Name = “2005”;
vehicleConfiguration.Make = new IdNamePair();
vehicleConfiguration.Make.Id = 5;
vehicleConfiguration.Make.Name = “BMW”;
vehicleConfiguration.Model = new IdNamePair();
vehicleConfiguration.Model.Id = 5;
vehicleConfiguration.Model.Name = “M3”;
vehicleConfiguration.Trim = new IdNamePair();
vehicleConfiguration.Trim.Id = 151;
vehicleConfiguration.Trim.Name = “Coupe 2D”;
vehicleConfiguration.Engine = new IdNamePair();
vehicleConfiguration.Engine.Id = 5044;
vehicleConfiguration.Engine.Name = “6-Cyl. 3.2 Liter”;
vehicleConfiguration.Drivetrain = new IdNamePair();
vehicleConfiguration.Drivetrain.Id = 5049;
vehicleConfiguration.Drivetrain.Name = “RWD”;
vehicleConfiguration.Transmission = new IdNamePair();
vehicleConfiguration.Transmission.Id = 5049;
vehicleConfiguration.Transmission.Name = “6-Spd SMG”;
vehicleConfiguration.Mileage = 20000;
vehicleConfiguration.VehicleCondition = VehicleCondition.Excellent;

VehicleValuation vehicleValuation = proxy. GetVehicleValuesByVehicleConfiguration(authenticationKey, versionDate, true, stateAbbreviation,vehicleConfiguration)
如何将其转换为php

我已经开始编写这个方法,并且已经访问了另一个具有简单参数的方法

我只停留在“VehicleConfiguration”部分,我想这是一个对象

有人,帮帮我,我会给你信用的

谢谢。


<?php
$dateTime = date('m/d/Y',strtotime("01/01/2008"));
$stateAbbreviation = "CA";
$authenticationKey = "MzU=";

$vehicleConfiguration = new VehicleConfiguration();

echo "<pre>";
var_dump($vehicleConfiguration);
echo "</pre>";

class VehicleConfiguration {
    public $Year;
    public $Make;
    public $Model;
    public $Trim;
    public $Engine;
    public $Drivetrain;
    public $Transmission;
    public $Mileage;
    public $VehicleCondition;

    public function  __construct(){
        $this->Year = new IdNamePair(2005, '2005');
        $this->Make = new IdNamePair(5, 'BMW');
        $this->Model = new IdNamePair(5, 'M3');
        $this->Trim = new IdNamePair(151, 'Coupe 2D');
        $this->Engine = new IdNamePair(5044, '6-Cyl. 3.2 Liter');
        $this->Drivetrain = new IdNamePair(5049, 'RWD');
        $this->Transmission = new IdNamePair(5049, '6-Spd SMG');
        $this->Mileage = 20000;
        $this->VehicleCondition = 'Excellent';

        return $this;
    }
}

class IdNamePair{
    public $Id;
    public $Name;
    public function __construct($id = NULL, $name = NULL){
        $this->Id = $id;
        $this->Name = $name;
        return $this;
    }
}
?>

ana前级车辆配置(库文件夹)
<?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;
    }   
}
类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;
    }   
}

车辆配置有什么问题?你为什么卡住了?我格式化车辆配置的方式可能是错误的。因为我访问的某个方法正在工作。例如这就是我在php中访问其他方法的方式。$get\U car\U里程->authenticationKey=$key;$get\u car\u里程->车辆类型=$car\u类型;$get\U car\U里程->版本日期=$var\U日期;$get\u car\u里程->年id=$year\u id;$result=$soap\u connect->\u soapCall('GetZeroPointMileageByYear',数组($get\u car\u Milege));(此方法没有诸如VehicleConfiguration之类的参数)这是c#testDate=“01/01/2008”versionDate=CDate(testDate)vehicleType=“UsedCar”yearId=CInt(cboYears.SelectedValue)AuthenticationKey=“MzU=”Proxy”中给出的示例。GetZeroPointMileageByYear(AuthenticationKey,vehicleType,versionDate,true,yearId,true,out GetMileAgeeResult,out Results Specified)是的,但我使用了codeigniter。我最近创建了一个类,我们的代码基本相同,特别是在类的结构上。
        $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));