I'm getting a 500 internal error response when I try to retrieve data via SOAP.

What I have that's working and not giving me 500 internal error:

$client = new SoapClient('http://example.com/api/v2_soap/?wsdl');
$session = $client->login('xxx', 'xxx');
$complexFilter = array(
    'complex_filter' => array(
            'key' => 'type',
            'value' => array('key' => 'in', 'value' => 'simple,configurable')
$result = $client->catalogProductList($session, $complexFilter);

foreach ($result as $key => $value) {
    $id = $value->product_id;
    echo $id;
   // productPrices($id); <-- this issue causes the error.


When I then try to call a funtion in the foreach loop (see comment above):

function productPrices($id){
    $client = new SoapClient('http://example.com/api/soap/?wsdl');
    $session = $client->login('xxx', 'xxx');
    $att = array("visibility","sku","special_price", "price");
    $arguments = array( $id, NULL, $att);
    $resultPrice = $client->call($session, 'catalog_product.info', $arguments);
    echo $resultPrice['visibility'].",".$resultPrice['sku'].",".$resultPrice['special_price'].",".$resultPrice['price'];

The response I get from the server is now internal error 500. I have maximum 90 sku's/product ids.

Anyone know what the error might be?

  • please increase max_execution_time & memory_limit in your server
    – Abdul
    Nov 10 '15 at 7:05

Untested but something like this should work:

class Foo_Bar {
    $_client = new SoapClient('http://example.com/api/soap/?wsdl');
    $_session = $client->login('xxx', 'xxx');

public function productPrices($id) {
    $client = $this->_client;
    $session = $client->login('xxx', 'xxx');
    $att = array("visibility","sku","special_price", "price");
    $arguments = array( $id, NULL, $att);
    $resultPrice = $client->call($session, 'catalog_product.info', $arguments);
    echo $resultPrice['visibility'].",".$resultPrice['sku'].",".$resultPrice['special_price'].",".$resultPrice['price'];
  • Not working as is, something is missing as the php code fails of the top. Showing blank page. Jun 24 '15 at 16:58
  • What happens when you access http://example.com/api/soap/?wsdl via browser? Also check your web servers error.log file for more insight to the 500 error.
    – B00MER
    Jun 24 '15 at 17:09
  • As described there is no issue I get the full output from the store on soap url. Jun 24 '15 at 17:13
  • When I call the function in the foreach loop - I write : productPrices->Foo_Bar($id); isen't that correct? Jun 24 '15 at 17:16
  • magentocommerce.com/api/soap/catalog/catalogProduct/… should give you a working example to try.
    – B00MER
    Jun 25 '15 at 19:42

It seems Magento threw an Exception wich result in Internal Server Error. For me helped that I log all exceptions that are thrown by adding

self::log(debug_backtrace()[0]['file'].":".debug_backtrace()[0]['line']." - ".$message, 1, 'exceptions.log');

before the line throw new Mage_Core_Exception($message); in the throwException Method in app/Mage.php file

Hope that help you find your specific error



Please see log files for more information:

  • Magento logs <magento_root>/var/log/* - especially system.log and exception.log
  • See also whether new report files were created <magento_root>/var/report/
  • Webserver logs /var/log/nginx/(error|access).log or in case you use Apache /var/log/(apache|httpd)/*.log
  • PHP(-fpm) logs - often here /var/log/fpm-php.www.log


The default behaviour of the SoapClient is different to browsers behaviour. Especially following redirects, etc... Is http correct? Maybe you need https?

Webserver configuration

Maybe your webserver is configured to accept only browser requests. E.g. by UserAgent rules...? Or the API route has special protection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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