The problem
I'm having trouble creating an order using the Magento SOAP api. I've got all the bare necessities in place (code snippet below) but everytime I try to create the order it fails with status code 1008 (See Magento Docs).
There is no fault message though, so I only know the order creation failed.
$cart_id = $magi->execute("cart.create");
$customerEntity = $magi->execute("customer.info",5);
$customerEntity["mode"] = "customer";
$customerAddressEntity = $magi->execute("customer_address.info",$customerEntity["default_billing"]);
$customerAddressEntity["mode"] = "billing";
$magi->execute("cart_customer.set", array($cart_id,$customerEntity));
$magi->execute("cart_customer.addresses", array($cart_id,array($customerAddressEntity)));
$productEntity = array("product_id" => 48,"qty" => 1);
$magi->execute("cart_product.add",array($cart_id,array($productEntity)));
$magi->execute("cart_payment.method",array($cart_id,array("method" => "banktransfer")));
$orderId = $magi->execute("cart.order", array($cart_id));
In the magento log the following messages are logged after this operation.
Undefined offset: 0/var/www/cloud2u.nl/mccloud_n/app/code/core/Mage/Checkout/Model/Cart/Payment/Api.php
Undefined variable: websiteId/var/www/cloud2u.nl/mccloud_n/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php.
(this entry repeats itself 3 times after this one, each half a second apart).
I am at a loss here, it was in working condition a couple of weeks ago and not much has changed since then.
More information
The $magi variable holds an object that is an abstraction for using the Magento Soap api. It also catches and logs all errors, hence no try/catch blocks in this code.
- Magento version: 1.7.0.0
- Php version 5.4.6
- Server OS: Ubuntu 11.10 (development server)