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

Exception thrown when calling CashBookEntry_CreateFromData SOAP API

0

Hello, I am trying to use the SOAP API to create Cash Book Entries. The following code works and creates the entry.

$client->CashBookEntry_Create(
    array(
        "type" => "DebtorPayment",
        "cashBookHandle" => array("Number" => 2),
        "debtorHandle" => array("Number" => "1")
    )
);
 
However when I try to create a Cash Book Entry with data, I get the following exception:

PHP Fatal error:  Uncaught SoapFault exception: [soap:Client] Economic.Api.Exceptions.ValidationException(E04010): Null handles not allowed when creating or updating entities. (id=b7db1b66-2428-4323-a26a-1a781db49073) in /home/mikkel/web/ncb/economics.php:103
Stack trace:
#0 /home/mikkel/economics.php(103): SoapClient->__call('CashBookEntry_C...', Array)
#1 /home/mikkel/economics.php(103): SoapClient->CashBookEntry_CreateFromData(Array)
#2 {main}
  thrown in /home/mikkel/web/ncb/economics.php on line 103

Since the error message isn't of much help, (I've tried filling out every single parameter mentioned at https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=CashBookEntry_CreateFromData), I was wondering if anyone have a working example of using the SOAP api to create a Cash Book Entry with data.

The code that throws the exception is this:

/** the spelling is intended, documentation states that Create uses camel case but CreateFromData does not **/
$data = array(
    "Type" => "DebtorPayment",
    "CashBookHandle" => array("Number" => 2),
    "DebtorHandle" => array("Number" => "1"),
    "Date" => date("m/d/Y"),
    "VoucherNumber" => 50070,
    "AmountDefaultCurrency" => 100,
    "Amount" => 100,
    "CurrencyHandle" => array("Code" => "DKK")
);
$client->CashBookEntry_CreateFromData($data);
 
 
Any help would be much appreciated.

*EDIT* fixed a mistake when copying over code, error persists
 
 
created Aug 23, 2016 by mikkeleh
0% Accept Rate

edited Aug 23, 2016 by mikkeleh
Q 1 A 0 C 0

1 Answer

0

Hi Mikkel

Here's the XML you're submitting:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns1="http://e-conomic.com"><SOAP-ENV:Body><ns1:CashBookEntry_CreateFromData/></SOAP-ENV:Body></SOAP-ENV:Envelope>

For debugging purposes we recommend installing a proxy tool such as Fiddler to gain insight into what's actually being sent to the SOAP API.
answered Aug 23, 2016 by olej
Visma e-conomic A/S
...