magento-lts: Access denied when connecting via SOAP
A customer used before the update to openmage api calls for some marketing stuff. After the update to openmage, it is not possible to connect via soap.
For testing I created a new user with full permissions. I tried to connect with the following snippet
<?php 
try {
$client = new SoapClient('https://www.domain.com/api/v2_soap/?wsdl=1');
$session = $client->login('APIUSER', 'APIPASSWORD');
print '<pre>Works: '.print_r($session,1).'</pre>';
}
catch (Exception $e) {
print '<pre>Does not work: '.print_r($e,1).'</pre>';
}
?>
As result I get the faultstring “Access denied” with faultcode 2. I tested this with enabled and with disabled ws-i conformitiy. Even with enabled and disabled wsdl-cache. I always cleared the caches when I changed anything. Does anyone has an idea what could be wrong?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 32 (30 by maintainers)
The OP’s issue was already resolved. It was caused by the migration process.
Hi Guys,
Just thought I would add my fix for this issue.
I added -MultiViews to the .htaccess file and it seemed to resolve the issue.
Let me sum up common issues which occur when using SOAP:
curl -I https://myhostname/api/soap?wsdl) from ssh command line, this problem often results in the error “Error WSDL: SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘http://Myhostname/api/soap?wsdl’ : failed to load external entity”Content-lengthheaderindex.php(/api/soapinstead ofindex.php/api)nginx:
check response from
/api/v2_soap?wsdl=1an make sure there are no url’s withindex.phpinside (if there are, try clearing cache)use the following scripts to debug connection using soap v1:
or for SOAP 2