我在Web服务中有一个类(用C#编写)我需要在我的php页面中实例化这个类并为其元素赋值。 这是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;
我已经在我的php页面中连接到webserive,但我不知道如何实例化属于Web服务的这个类,并为其元素赋予价值,如年份,品牌,模型,..... / p>
这是我尝试但没有工作:
$vconfig = new $client.VehicleConfiguration;
$vconfig->$Year= "2009"
$ client是我的肥皂初始化:
$client = new nusoap_client('https://id.b.com/3.0/Vehicle.svc?wsdl', 'wsdl',
$proxyhost, $proxyport, $proxyusername, $proxypassword);
我尝试做的与C#中的相似:
ServiceReference1.VehicleConfiguration vconfig = new ServiceReference1.VehicleConfiguration();
vconfig.Make = "toyota";
vconfig.Model = "MG";
答案 0 :(得分:0)
$proxy = $client->getProxyClassCode();
print_r($proxy);
您可以使用上面的代码显示Web服务公开的可用方法。您应该能够查看WSDL并了解如何传递params以获取服务的响应。
我没有使用nu_soap,但我会想像
$params = array("Make" => "Toyota", "Model" => "MG" );
$result = $client->call('VehicleConfiguration', $params);