I'm having issues connecting to the Magento SOAP API via PHP's SoapClient. I have a small test PHP file setup on my dev server with the following code:
<?php
$soapC = new SoapClient('http://XXXX.com/api/soap/?wsdl', array('trace'=>true, 'exceptions'=>false));
$session = $soapC->__soapCall('login', array('TestUsr', 'test123'));
var_dump($session);
?>
The PHP file is on the same server as my magento dev build. When I run the php script via the command line, the $session variable outputs a SoapFault object with an error that says "looks like we got no XML document".
Not sure how to resolve this. When I try the code below I'm able to get a print out of all of the API methods, but for some reason the login method call above is causing problems.
$soapC = new SoapClient('http://XXXX.com/api/soap/?wsdl', array('trace'=>true, 'exceptions'=>false));
print_r($soapC->__getFunctions());
I realized the issue was that when the server tried to access the wsdl file, Magento was issuing a 302 redirect to the storefront.
To fix it, I logged into the Magento admin panel, navigated to System -> Configuration -> Web, and turned off "Auto-redirect to Base URL". Works like a charm now.