Magento API: v2_soap Does Not Use Call()

If you are utilizing Magento’s API and have checked out the documentation, you’ll see that they have included a V2 of their soap API saying:

As of v1.3 you may also use http://yourmagentohost/api/v2_soap?wsdl=1 which has been added to improve compatbility with Java and .NET.

If you find the need to utilize the v2_soap API, take note that you will need to call your methods differently than the documentation explains.

For example, if you would like to use the sales_order.info method, using the standard soap API, you would do the following to get all the order info for order number 1000000142:

$client = new SoapClient('http://yourwebsite.com/api/soap/?wsdl');
$session = $client->login('username', 'password');
$result = $client->call($session, 'sales_order.info', '1000000142');

If you need to use the V2 API, you need to so it slightly different. Instead of using the call() method, you call the specific API method instead:

$client = new SoapClient('http://yourwebsite.com/api/soap/?wsdl');
$session = $client->login('username', 'password');
$result = $client->salesOrderInfo($session, '1000000142');

So, for V2, you must convert the method names in the Magento documentation to a camel-case method name.

This entry was posted in Magento. Bookmark the permalink.

One Response to Magento API: v2_soap Does Not Use Call()

  1. Victor says:

    Hi, I would appreciate if you have a look to this:

    I need to set limit using magento api V2 making soap calls.

    here is an example of my code:
    ———————————————–
    $client = new SoapClient($this->api_soap_url);
    $session_id = $client->__soapCall(‘login’,array(‘user’, ‘password’));

    $data = array($session_id);

    $result = $client->__soapCall(‘customerCustomerList’, $data);
    ———————————————–

    This returns all customers, but don’t know how to set limit here.

    Thanks in advance