I tried to generate token for magento2 SOAP API but i am getting below error
Error:
Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] SoapServer::SoapServer(): Invalid parameters in /var/www/html/magento2011/test.php:36 Stack trace: #0 /var/www/html/magento2011/test.php(36): SoapClient->__call('integrationAdmi...', Array) #1 {main} thrown in /var/www/html/magento2011/test.php on line 36
Script:
<?php
ini_set('display_errors', 1);
$params = array('username' => 'soapadmin','password' => 'test@1234');
$request = new SoapClient('http://127.0.0.1/magento2011/soap/default?wsdl&services=integrationAdminTokenServiceV1',array('soap_version' => SOAP_1_2));
$token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken($params);
?>
Best Answer
Try below code, this works for me:-