Remote Access via SOAP in Magento – the short version

Keeping it short. After I got (c)Rackspace to turn on SOAP I had to step back for a while, those tech support issued wear me down. I could have turned it on myself, but we have a full service contract.

Now I am left with mostly 500 errors, occasional 404 (mod_rewrite was dropping page not found error).

After hitting the forums, over and over enjoyed some seriously WACKED solutions. Still nothing was working. Until I hit this post:

http://www.magentocommerce.com/boards/viewthread/42062/

In short Magento programmers FAILED hard core. Besides not testing, they are not even using code-intelligent IDE’s? Any modern developmetn environment woudl have picked up the error. In Komodo there is a green check mark or re error icon on the bottom of the page looking for syntax errors. This is how I found this error.

Talking change, in the file /app/code/core/Mage/Api/Model/Server/Adapter/Soap.php at line 144 (approx) is this original code:

}else {
 $this->fault('0', 'Unable to load Soap extension on the server');
 return $this;
 }

Where a “}” was missing:

else {
$this->fault('0', 'Unable to load Soap extension on the server');
} // <--- This one is missing, line 135
return $this;
}

Ouch.

So, on to getting this stuff working – fast version:

$proxy = new SoapClient('http://YourSite/api/soap/?wsdl');
$sessionId = $proxy->login('apiuser', 'apipassword');

// ****** Gets core info based on Sku
$products = $proxy->call($sessionId, 'catalog_product.info', 'productsku');
var_dump($products);

The above code will return an array / dump of the product info based on sku via a SOAP call.

You will need to get the API user and password as well as the role dialed in on the admin.

Good Luck.

Addendum : Need images, this will dump and array for the sku with image information:

var_dump($proxy->call($sessionId, 'product_media.list', 'productsku'));
This entry was posted in Magento commerce, Programming and tagged , , . Bookmark the permalink.

One Response to Remote Access via SOAP in Magento – the short version

  1. Marc says:

    Update – this error is gone in recent releases. Still I fear what else might have been missed

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>