Frage

I am using SOAP api to integrate an ERP system but throws fatal error Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Client] Error cannot find parameter

<?php
require_once(__DIR__ . '/app/Mage.php');
Mage::app();

$api_url_v2 = "https://ninobambino.in/index.php/api/v2_soap/?wsdl=1";

$username = 'test123';
$password = 'test123';

$cli = new SoapClient($api_url_v2);

//retreive session id from login
//$session_id = $cli->login($username, $password);
$session = $cli->login('test123', 'test123');

//call customer.list method
$result = $cli->customerCustomerList($session_id);
print_r($result);
War es hilfreich?

Lösung

Problem is when you pass session to get customer list $result = $cli->customerCustomerList($session_id);

Now change to following code:


<?php
$api_url_v2 = "https://ninobambino.in/index.php/api/v2_soap/?wsdl";

$username = 'test123';
$password = 'test123';

$cli = new SoapClient($api_url_v2);

//retreive session id from login
//$session_id = $cli->login($username, $password);
$session = $cli->login('test123', 'test123');

//call customer.list method
$result = $cli->customerCustomerList($session);
print_r($result);

Andere Tipps

Now Magento SOAP API have updated logic for get session ID using login method. Try below mentioned code.

try{

  $wsdlUrl = 'https://www.yourdomain.com/api/v2_soap/?wsdl';
  $client = new SoapClient($wsdlUrl);
  // $sessionId = $client->login("******","******");
  $auth_resp = $client->login(array("username"=>"Your username","apiKey"=>"API key"));
  $sessionId = $auth_resp->result;    
}catch(Exception $e){
  echo '<pre>';
  print_r($e);
  exit;
}

echo $sessionId;exit; 
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top