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

SOAP API ,Order_CreateFromData method produce error

0

Hi

I am very new e-conomic SOAP API.

I am trying to create  test order from my site to e-conomic.

But iam getting  the folowing error


"Economic.Api.Exceptions.ValidationException(E04010): Null data entities not allowed when creating or updating entities. (id=5dc164b6-65c6-4439-8b21-bf2cc8c72371)"

 

Following is my code

------------------------------

$wsdlUrl = 'https://api.e-conomic.com/secure/api1/EconomicWebservice.asmx?WSDL';
$client = new SoapClient($wsdlUrl, array("trace" => 1, "exceptions" => 1));
$client->ConnectWithToken(array(
'token' => "XXXXXXX",
'appToken' => "XXXXXX"));
 

try{
    $client->Order_CreateFromData(array(
        'Number' =>30068,
        'Date'   =>'2015-12-09 10:00:00',
        'DueDate'   =>'2015-12-12 10:00:00',
        'ExchangeRate'   =>20.00,
        'IsVatIncluded'=>true,
        'DeliveryDate'=>'2015-12-11 10:00:00',
        'IsArchived' =>false,
        'IsSent'=>true,
        'NetAmount' =>50.00,
        'VatAmount' =>5.00,
        'GrossAmount' =>55.00,
        'Margin' =>15.00,
        'MarginAsPercent' =>1.00
    )          
    );
   echo "oder created";
} catch (Exception $exception) {
  print("<p><i>" . $exception->getMessage() . "</i></p>");
}
 

Any one have any idea ?

Thanks in advance

created Dec 11, 2015 by lintocalpine
100% Accept Rate

edited Dec 14, 2015 by olej
Q 1 A 0 C 0

1 Answer

+1
 
Best answer

Hi Linto

You were sending an empty array.

<?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:Order_CreateFromData/></SOAP-ENV:Body></SOAP-ENV:Envelope>;
 
I recommend you try printing your output to your logs while developing so you may debug what you're transmitting to the API.
Even better: Use a tool like Fiddler to debug what's actually being transferred across the wire. :-)
answered Dec 14, 2015 by olej
selected Dec 15, 2015 by lintocalpine
Visma e-conomic A/S
...