I am not able to access product details using SOAP API while i call api url i am getting Error:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from '' : failed to load external entity "" in /opt/lampp/htdocs/test_magento_2/api.php:59 Stack trace: #0 /opt/lampp/htdocs/test_magento_2/api.php(59): SoapClient->SoapClient('http://127.0.0....', Array) #1 {main} thrown in /opt/lampp/htdocs/test_magento_2/api.php on line 59

I am using magento 2.1.5 and I have also set necessary setting in php.ini files for soap like
i am facing this issue in my local system and in live server.

My code for call SOAP API:

$token = 'kxij7mg931mxc3h2hy7dyvxm9m3fy4k4';
$opts = ['http' => ['header' => "Authorization: Bearer " . $token]];
$wsdlUrl = '';
$context = stream_context_create($opts);
$soapClient = new SoapClient($wsdlUrl, ['version' => SOAP_1_2, 'context' => $context]);
$soapResponse = $soapClient->__getFunctions();

3 Answers 3


Try commenting out the foreach in vendor/magento/framework/Webapi/Authorization.php ( line 36 to 40 )

Should look like this:

public function isAllowed($aclResources)
    //foreach ($aclResources as $resource) {
    //    if (!$this->authorization->isAllowed($resource)) {
    //        return false;
    //    }
    return true;

I had the same problem, this fixed it.

  • I think we should allow resource from the integration section of API resources. That would do the magic! Commented Jul 5, 2018 at 10:11

perhaps you have a error or a missed configuration on permissions,

to check the WSDL comment this line in "Magento\Webapi\Model\AbstractSchemaGenerator":

protected function getAllowedServicesMetadata($requestedServices)
    $allowedServicesMetadata = [];
    foreach ($requestedServices as $serviceName) {
        $serviceMetadata = $this->getServiceMetadata($serviceName);
        foreach ($serviceMetadata[ServiceMetadata::KEY_SERVICE_METHODS] as $methodName => $methodData) {
            if (!$this->authorization->isAllowed($methodData[ServiceMetadata::KEY_ACL_RESOURCES])) { 

            //    unset($serviceMetadata[ServiceMetadata::KEY_SERVICE_METHODS][$methodName]);
        if (!empty($serviceMetadata[ServiceMetadata::KEY_SERVICE_METHODS])) {
            $allowedServicesMetadata[$serviceName] = $serviceMetadata;
    return $allowedServicesMetadata;

I tried the SOAP Web Services on my local host and it was working fine. The reason why the Magento 2 was not able to give a response to the request was because it was not able to verify SSL Certificates enabled on the site.

The way I resolved it was to allow self signed SSL verification:

$opts = [
    'http' =>
         'header' => "Authorization: Bearer ".$token
'ssl' => [
    'allow_self_signed' => true , 
    'verify_peer' => false, 
    'verify_peer_name' => false]
$context = stream_context_create($opts);

I hope it helps. ;)

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.