Magento Tutorials

Understanding Magento SOAP API

What is SOAP API?

SOAP (Simple Object Access Protocol) is a protocol for transmitting structured information in computer networks. It uses XML for its message format, which allows computers running on different platforms (Windows and Linux, e.g.) to communicate to each other, as long as those computers support web service protocol (HTTP for example).

Magento SOAP API

Magento 1 and Magento 2 are both SOAP-included.

Magento 1

API format in Magento 1:


XML result:

magento 1 api

From Magento version 1.3, SOAP API is updated into version 2 to better support Java and .NET. Hence, URL format is changed into:

magento 1.3 api

Magento 2

API format in Magento 2:

magento 2 api

Create User and Role to use API

Create Role

  1. In your Magento backend, go to System > Web Services > SOAP/XML-RPC – Roles.
  2. Click Add New Role.
  3. Under Role Info, enter a name for this role. You may need to enter current admin password to continue.
  4. Under Role Resources, choose which resources this role can access to.

Create User

  1. In your Magento backend, go to System > Web Services > SOAP/XML-RPC – Users.
  2. Click Add New User.
  3. Under User Info, enter the necessary information.
  4. Under User Role, select a role for this user.

Example: Using SOAP API in PHP to get category tree

SOAP v1:

$client = new SoapClient('');
$session = $client->login('apiUser', 'apiKey');
$result = $client->call($session, '', '5');

SOAP v2:

$proxy = new SoapClient('');
$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
$result = $proxy->catalogCategoryInfo($sessionId, '5');
soap v2 api

You can refer to APIs in this Magento document:

Read more:
How to Use AJAX Requests in Magento
Magento API for Android


A knowledge craver who always strive to be wiser everyday.

Notify of
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Jerome Nicholas
Jerome Nicholas
2 years ago

An Error occurred while handling another error:
exception ‘ReflectionException’ with message ‘Method SoapClient::login() does not exist’ in

1 year ago

Hello Dom thanks for informative article. Just a problem like you print_r and debug the object. How can i see raw xml on browser from this script? please guide me