2

I'm trying to insert an order via the soap calls. I can't figure out what calls would be needed to create and tie off an order, start to finish.

I'm not doing this in php, but if I have all the calls listed in the wsdl, then I could figure out what they're really called..

I just really need the names of the standard calls.

2
  • What did you try? What calls did you made and what is your exact problem? The wsdl can be found here: demo.magentocommerce.com/api/?wsdl Aug 20, 2013 at 8:17
  • I am not in the try phase. I can easily call all the soap I just need to know what the calls are :) Thanks for helping with the WSDL.. it's slightly different than the one I'm targeting, but nice to see.
    – baash05
    Aug 20, 2013 at 12:51

2 Answers 2

2

Here you have a php example (from the Magento API manual) on how to create an order with the needed calls:

/**
 * Example of order creation
 * Preconditionsare as follows:
 * 1. Create a customer
 * 2. Сreate a simple product */

$user = 'apiUser';
$password = 'apiKey';
    $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
    $sessionId = $proxy->login($user, $password);
    $cartId = $proxy->shoppingCartCreate($sessionId, 1);
    // load the customer list and select the first customer from the list
    $customerList = $proxy->customerCustomerList($sessionId, array());
    $customer = (array) $customerList[0];
    $customer['mode'] = 'customer';
    $proxy->shoppingCartCustomerSet($sessionId, $cartId, $customer);
    // load the product list and select the first product from the list
    $productList = $proxy->catalogProductList($sessionId);
    $product = (array) $productList[0];
    $product['qty'] = 1;
    $proxy->shoppingCartProductAdd($sessionId, $cartId, array($product));

    $address = array(
        array(
            'mode' => 'shipping',
            'firstname' => $customer['firstname'],
            'lastname' => $customer['lastname'],
            'street' => 'street address',
            'city' => 'city',
            'region' => 'region',
            'telephone' => 'phone number',
            'postcode' => 'postcode',
            'country_id' => 'country ID',
            'is_default_shipping' => 0,
            'is_default_billing' => 0
        ),
        array(
            'mode' => 'billing',
            'firstname' => $customer['firstname'],
            'lastname' => $customer['lastname'],
            'street' => 'street address',
            'city' => 'city',
            'region' => 'region',
            'telephone' => 'phone number',
            'postcode' => 'postcode',
            'country_id' => 'country ID',
            'is_default_shipping' => 0,
            'is_default_billing' => 0
        ),
    );
     // add customer address
    $proxy->shoppingCartCustomerAddresses($sessionId, $cartId, $address);
    // add shipping method
    $proxy->shoppingCartShippingMethod($sessionId, $cartId, 'flatrate_flatrate');

    $paymentMethod =  array(
        'po_number' => null,
        'method' => 'checkmo',
        'cc_cid' => null,
        'cc_owner' => null,
        'cc_number' => null,
        'cc_type' => null,
        'cc_exp_year' => null,
        'cc_exp_month' => null
    );
     // add payment method
    $proxy->shoppingCartPaymentMethod($sessionId, $cartId, $paymentMethod);
     // place the order
    $orderId = $proxy->shoppingCartOrder($sessionId, $cartId, null, null);
1
  • Wow... thanks! Php is a little hard, but I can suss out the calls. Thanks
    – baash05
    Aug 20, 2013 at 12:41
0

here is the solution Create appropriate role (Magento Admin) Create web services user (Magento Admin) Assign created role to the user (Magento Admin) Log-in to web service and retrieve Session Id (Soap Client) Call appropriate method (Soap Client)

here is the link for magento api uses http://www.magentocommerce.com/api/soap/introduction.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.