简体   繁体   中英

instantiate webservice class in php

I have a class in web service(written in C#) I need to instantiate this class in my php page and give value to its elements. This is the class in webservice:

 public partial class VehicleConfiguration : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {

    [System.NonSerializedAttribute()]
    private System.Runtime.Serialization.ExtensionDataObject extensionDataField;

    private int IdField;

    private string VINField;

    private ConsumeKbbAPI.ServiceReference1.IdStringPair YearField;

    private ConsumeKbbAPI.ServiceReference1.IdStringPair MakeField;

    private ConsumeKbbAPI.ServiceReference1.IdStringPair ModelField;

    private ConsumeKbbAPI.ServiceReference1.IdStringPair TrimField;
    //private ConsumeKbbAPI.ServiceReference1.VehicleTrim TrimField;



    private int MileageField;

    private ConsumeKbbAPI.ServiceReference1.EquipmentOption[] OptionalEquipmentField;

    private System.DateTime ConfiguredDateField;

I have connected to webserive in my php page, but I don't know how to instantiate this class that is belong to the web service and give value to its elements like year, make, model,.....

that is I tried but not working:

$vconfig = new  $client.VehicleConfiguration;

$vconfig->$Year= "2009"

$client is my soap initialization:

$client = new nusoap_client('https://id.b.com/3.0/Vehicle.svc?wsdl', 'wsdl',
                    $proxyhost, $proxyport, $proxyusername, $proxypassword);

what I try to do is similar to this in C#:

    ServiceReference1.VehicleConfiguration vconfig = new ServiceReference1.VehicleConfiguration();

         vconfig.Make = "toyota";
         vconfig.Model = "MG";
$proxy = $client->getProxyClassCode();
print_r($proxy);

You can use the code above to display the available methods exposed by the web service. You should be able to look at the WSDL and see how to pass the params in to get a response from the service.

I haven't used nu_soap, but I would think something like

$params = array("Make" => "Toyota", "Model" => "MG"  );
$result = $client->call('VehicleConfiguration', $params);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM