简体   繁体   English

在php中实例化webservice类

[英]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. 我在Web服务中有一个类(用C#编写),我需要在php页面中实例化该类并为其元素赋值。 This is the class in webservice: 这是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,..... 我已经在php页面中连接到webserive,但是我不知道如何实例化属于Web服务的此类并赋予其诸如年,品牌,型号等元素的价值。

that is I tried but not working: 那是我尝试过但没有工作:

$vconfig = new  $client.VehicleConfiguration;

$vconfig->$Year= "2009"

$client is my soap initialization: $ client是我的肥皂初始化:

$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#: 我尝试做的事情与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. 您可以使用上面的代码来显示Web服务公开的可用方法。 You should be able to look at the WSDL and see how to pass the params in to get a response from the service. 您应该能够查看WSDL,并了解如何传递参数以从服务获得响应。

I haven't used nu_soap, but I would think something like 我还没有使用nu_soap,但是我会认为

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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