API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Invoice Line Creation with REST: CurrentInvoice_CreateFromDataArray

0

I am trying to create Line for invoice,

but this function

https://api.e-c$invoiceIdonomic.com/secure/api1/economicwebservice.asmx?op=CurrentInvoiceLine_CreateFromDataArray

Gives me an error: SOAP-ERROR: Encoding: object has no 'Number' property

To create invoice I used this function: CurrentInvoice_CreateFromDataArray

that is PHP

$createinvoice = $client->CurrentInvoice_CreateFromDataArray(
                    array('dataArray' =>
                        array(
                            'CurrentInvoiceData' => array (
                            'DebtorHandle'    => array('Number' => 456),
                            'DebtorName' => 'Martin Iden',
                            'TermOfPaymentHandle'    => array('Id' => 1 ),
                            'Date' => date("c"),
                            'DueDate' => date('c', strtotime("+".$daysToAdd." days")),
                            'CurrencyHandle'    => array('Code' => 'DKK' ),
                            'ExchangeRate' => 1.00,
                            'IsVatIncluded' => false,
                            'DeliveryDate' => date("c"),
                            'NetAmount' => 4500,
                            'VatAmount' => "0.00",
                            'GrossAmount' => 4300,
                            'Margin' => 20.00,
                            'MarginAsPercent' => 40.00
                            )
                        )
                    )
                )->CurrentInvoice_CreateFromDataArrayResult;
                
                $invoiceId = $createinvoice->CurrentInvoiceHandle->Id;

Now I have $invoiceId and I need to create a line for this invoice, using this $invoiceId

but this function

https://api.e-c$invoiceIdonomic.com/secure/api1/economicwebservice.asmx?op=CurrentInvoiceLine_CreateFromDataArray

Gives me an error: SOAP-ERROR: Encoding: object has no 'Number' property

This is specification of different Numbers and Id's from 

CurrentInvoiceLine_CreateFromDataArray


          <Handle>
            <Id>int</Id>
            <Number>int</Number>
          </Handle>
          <Id>int</Id>
          <Number>int</Number>
          <InvoiceHandle>
            <Id>int</Id>
          </InvoiceHandle>

QUESTION: where in this code for CurrentInvoiceLine_CreateFromDataArray abowe my $invoiceId ?

Why I am receiving SOAP-ERROR: Encoding: object has no 'Number' property?

$bookinvoice = $client->CurrentInvoiceLine_CreateFromDataArray(
                            array('dataArray' =>
                                    array(
                                            'CurrentInvoiceLineData' => array (
                                            'Handle'    => array('Id' => $invoiceId),
                                            'Number' => 1, // is this $invoiceId?
                                           ...
                                        )
                                    )
                            )
                    );

created Dec 21, 2015 by webmat
0% Accept Rate
Q 6 A 0 C 1

1 Answer

0
Hi Webmat

Please share the entire line creation data. One must adhere strictly to the XML schema when posting to a SOAP service.
answered Dec 21, 2015 by olej
Visma e-conomic A/S
...