0

I have this type of WebService

enter image description here

How can I get products detail using Magento 1.9, kindly explain me in detail that how can I get data using this Webservice. If someone can list down the step how can I achieve this.

Really appreciate for help.

1

You can follow steps below carefully to call magento API

step 1: Create SOAP Role from Admin Panel

1) Please go to System -> Web Service -> SOAP/XML-RPC -Roles

2) Click "Add New Role".

3) Enter Role name (like "api_user") and enter admin password

4) Select Role Resources. You can select All or Custom depending on your needs.

5) Click "Save Role" button.

enter image description here

step 2: Create SOAP User from Admin Panel

1) Please go to System -> Web Service -> SOAP/XML-RPC -Users

2) click Add New user

3) Please enter all data for new soap user. Make sure you have saved the "User Name" and the "API Key" in a file for feature use in API call.

4) Click "User Role" tab.

5) Select the role to assign to the Soap user

6) click "Save user" button

enter image description here

**step 3: create a php file , Call the Magento Product details API **

Note: Please change soap user name, API key and Web Url with your data from the php script.

<?php
error_reporting(-1);
ini_set('display_errors', 'On');
const SOAP_API_USER = 'your_soap_user_name';
const SOAP_API_PASS = 'your_soap_api_key';
const SOAP_API_ENDPOINT = 'http://YOURPROJECTWEBURL/index.php/api/v2_soap/?wsdl';

$soapClient = new SoapClient(SOAP_API_ENDPOINT, array('trace' => true,
'keep_alive' => true,
'connection_timeout' => 5000,
'cache_wsdl' => WSDL_CACHE_NONE,
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,));

$sessionId = $soapClient->login(SOAP_API_USER, SOAP_API_PASS); // apiUser , apiKey        
$productId  = 4; // Product Id to get details
$result = $soapClient->catalogProductInfo($sessionId,$productId);
var_dump($result);
  • in magento where i have to add this type of code to get the products,, i attached an image: POST /test/service.asmx HTTP/1.1 Host: soap.unze.co.uk Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="w3.org/2001/XMLSchema-instance" xmlns:xsd="w3.org/2001/XMLSchema" xmlns:soap12="w3.org/2003/05/soap-envelope"> <soap12:Body> <GetWebProducts xmlns="fashionmaster"> <ReturnCol>string</ReturnCol> </GetWebProducts> </soap12:Body> </soap12:Envelope> – Hafiz Arslan Apr 3 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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