3

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);
1
  • try with $session = $cli->login((object)array('username' => 'test123', 'apiKey' => 'test123'));
    – zus
    Commented Nov 15, 2018 at 12:03

2 Answers 2

4
+25

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);
0

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; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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