Tuesday, January 3, 2012

Creating or Calling deafult Soap or Webservice API in magento programmatically

Hi,

As you all know in magneto we can create web services by using soap in magento
Magento as set of default API, i am using one default api writing code please check it

First Create web service user and role in magneto back end (system->Web Service) and assign roles to user

Enable soap dll i'e extension=php_soap.dll from your php.ini file

Paste this code in file and place this file in root folder or as you wish and run this file through browser




<?php
$proxy = new SoapClient('http://yourdomine/index.php/api/soap/?wsdl');

$sessionId = $proxy->login('USERNAME', 'API_Key');  // you will get this when you create web service user in admin side
     
   $filters = array(
    'sku' => array('like'=>'test%')
);
 
$products = $proxy->call($sessionId, 'product.list', array($filters));
 
var_dump($products);

?>

No comments:

Post a Comment