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

Problem with OrderLine_UpdateFromData

+1

        print_r($ProductArray);
        $ProductHandle = EC_CheckProduct($client,$ProductArray["Prod_Sku"]);
        if(!$ProductHandle) {
            $ProductHandle = EC_ProductCreateSingle($client,$ProductArray);
        }
        print_r($ProductHandle);
        $OrderLineHandle = $client->OrderLine_Create(array("orderHandle" => $OrderHandle))->OrderLine_CreateResult;
        $OrderLineRes= $client->OrderLine_UpdateFromData( array("data " => array(
            "Handle" =>  $OrderLineHandle,
            "Id" => $OrderLineHandle->Id,
            "Number" => $OrderLineHandle->Number,
            "OrderHandle" => $OrderHandle,
            "Description" => $ProductArray["Prod_Name"],
            "ProductHandle" => $ProductHandle,
            "Quantity" => $ProductArray["Prod_Quantity"],
            "UnitNetPrice" => $ProductArray["Prod_Price"],
            "UnitCostPrice" => 0,
            "TotalNetAmount" => 0,
            "TotalMargin" => 0,
            "MarginAsPercent" => 0,
            "DeliveryDate" => date("Y-m-d") . "T" . date("H:m:s"),
            "DiscountAsPercent" => 0,
        ) ) )->OrderLine_UpdateFromDataResult;

Gives

Array ( [Prod_Sku] => 999124 [Prod_Name] => Luft 2.0. Litte bättre, Lite trevligare [Prod_Price] => 0.8000 [Prod_Quantity] => 1 [Prod_Discount] => 0.0000 [Prod_Tax_Rate] => 25.0000 ) stdClass Object ( [Number] => 999124 )
Fatal error: Uncaught SoapFault exception: [soap:Server] Economic.Api.Exceptions.ServerException(E00000): An internal error has occurred. (id=59ef1234-b3a3-485d-af3e-ffc46c93c0dd) in

 

So Product is there, Oder and OrderLineHandle is OK.

So what is wrong?

created Apr 2, 2013 by PhpMadman
100% Accept Rate
Q 3 A 8 C 2

2 Answers

+2
 
Best answer

Hi PhpMadman,

From our logs I can see that your request body is empty:

 

I don't know where it fails, but try to use Fiddler2 to see what is sent.

Best regards,
Rasmus Beck
Developer, e-Conomic

answered Apr 3, 2013 by rbb
selected Apr 3, 2013 by PhpMadman
0
Changed it to this.

        $FullData = array("data" => $Data);
        $OrderLineRes= $client->OrderLine_UpdateFromData($FullData)->OrderLine_UpdateFromDataResult;

And now it works.
answered Apr 3, 2013 by PhpMadman
Visma e-conomic A/S
...