Php 致命错误:未捕获的SoapFault异常:[Client]SOAP-error:编码:SoapVar没有';enc#u类型';财产

Php 致命错误:未捕获的SoapFault异常:[Client]SOAP-error:编码:SoapVar没有';enc#u类型';财产,php,Php,我正在我的一个客户wordpress网站上使用PHP与Kashflow进行集成,它在PHP5.6之前运行得很好,但当我将网站升级到PHP7.1时,问题出现了,下面是我遇到的错误, 致命错误 :未捕获的SoapFault异常:[客户端]SOAP-ERROR:编码:SoapVar没有“enc_type”属性 下面是我的Kashflow类代码: public function insertInvoice(KashflowInvoice $invoice) { $li

我正在我的一个客户wordpress网站上使用PHP与Kashflow进行集成,它在PHP5.6之前运行得很好,但当我将网站升级到PHP7.1时,问题出现了,下面是我遇到的错误, 致命错误 :未捕获的SoapFault异常:[客户端]SOAP-ERROR:编码:SoapVar没有“enc_type”属性

下面是我的Kashflow类代码:

    public function insertInvoice(KashflowInvoice $invoice)

    {

        $lines = $this->prepareInvoiceLines($invoice->getLines());



        $parameters['Inv'] = array

        (

            "InvoiceDBID"       => 0,

            "InvoiceNumber"     => $invoice->getInvoiceNumber(),

            "InvoiceDate"       => $invoice->getInvoiceDate(),

            "DueDate"           => $invoice->getDueDate(),

            "Customer"          => "",

            "CustomerID"        => $invoice->getKashflowCustomerId(),

            "Paid"              => 1,

            "CustomerReference" => "",

            "EstimateCategory"  => "",

            "SuppressTotal"     => 1,

            "ProjectID"         => 0,

            "CurrencyCode"      => "GBP",

            "ExchangeRate"      => 1,

            "ReadableString"    => "",

            "Lines"             => $lines,

            "NetAmount"         => $invoice->getNet(),

            "VATAmount"         => $invoice->getTax(),

            "AmountPaid"        => 0,

            "CustomerName"      => "",

            "UseCustomDeliveryAddress" => 0

        );
            print_r($parameters);


        return $this->makeRequest("InsertInvoice",$parameters);

    }



    private function prepareInvoiceLines($invoice_lines)

    {

        if(NULL == $invoice_lines)
            return array();            

       $lines = NULL;            

        foreach($invoice_lines as $invoice_line)

        {

            $line = array(

                "LineID"      => 0,

                "Quantity"    => $invoice_line['qty'],

                "Description" => $invoice_line['description'],

                "Rate"        => $invoice_line['unit_net'],

                "ChargeType"  => $invoice_line['nominal_id'],

                "VatAmount"   => $invoice_line['qty'] * $invoice_line['unit_tax'],

                "VatRate"     => $invoice_line['tax_rate'],

                "Sort"        => 1,

                "ProductID"   => 0,

                "ProjID"      => $invoice_line['project_id']     
            );

          // Lines is an array of InvoiceLine as anyType.

           $lines[] = new SoapVar($line,0,"InvoiceLine","KashFlow");


        }



        return $lines;

    }
我调试了这段代码,如果我对“$lines[]=new SoapVar($line,0,“InvoiceLine”,“KashFlow”);”进行注释,这就是创造性的发票,所以我不确定这一行要更改什么

谢谢你的帮助

提前感谢。

$lines[]=新的SoapVar($line,0,“InvoiceLine”,“KashFlow”)

第二个参数应该是常量。例如,尝试使用SOAP_ENC_对象。更多信息可以在php文档中找到:参见示例#1。您可以尝试的常量列表位于此处:。对于基本类型和SOAP_ENC*,有效的是以XSD_u.开始的。
如果此操作失败,请发布wsdl文件。

将0替换为
SOAP\u ENC\u对象
,它适用于我的php版本7.0

$lines[] = new SoapVar($line,SOAP_ENC_OBJECT,"InvoiceLine","KashFlow");