Magento 1 SOAP API Connection Errors

Failed to Connect to Magento API

If you are having trouble getting Subscribe Pro to connect to your Magento installation API and are seeing the error in the screenshot above, please follow these steps to diagnose the issue.

Step 1 - Double-check the URL

Even if the URL looks correct, there may be an issue causing it not to function properly. To test this and to make sure that the output is correct, take your SOAP API URL and add ?wsdl to the end of it. Then try to visit that URL in a browser. You should see an XML document containing the Magento API wsdl that looks like the following screenshot.

Expected WSDL Output in a Browser

Step 2 - Check the API Credentials

Be sure to make sure the Web Services User and Role are properly set up in Magento (see this documentation for help setting that up). Then, make sure the values entered into Subscribe Pro for the Magento SOAP API Username and Magento SOAP API Key match the values in the Web Services user.

Mapping of Fields from SOAP API User to SP Credentials

Step 3 - Ensure SSL is Set Up Correctly

If the SSL/HTTPS protocol is improperly configured for your domain, it can cause issues connecting from Subscribe Pro to your Magento API.

Qualys SSL Labs offers a free site checker to find common issues with SSL setup. You can use their Analyze Tool to run this test and make sure your SSL is set up correctly.

Step 4 - Remove HTTP Basic Authentication (from .htaccess)

Subscribe Pro does not support HTTP Basic Authentication for connecting to Magento servers. This must be disabled in order for Subscribe Pro to connect successfully.

Step 5 - Run the Test Script

We have a script that can be run from any computer with PHP and a network connection that can access your Magento site. You can either download it from here or copy and paste the block of code below into a new file. You will need to set the $apiUser, $apiKey, $url, and $magentoStoreCode variables to the correct values before running the script.

// Set the user name here:
$apiUser = 'subscribepro';
// Set the password here:
$apiKey = 'subscribepro';
// Set the url here:
$url = '';
// Set the Magento store code here:
$magentoStoreCode = 'default';
// Create new SOAP client
$soapClient = new \SoapClient(
    $url . '?wsdl',
        'trace' => true,
        'exceptions' => true,
        'cache_wsdl' => WSDL_CACHE_BOTH,
        'keep_alive' => true,
// Login to Magento API and get session ID
$sessionId = $soapClient->login($apiUser, $apiKey);
try {
    // Call method and capture result
    $result = $soapClient->call($sessionId, 'cart.create', array(
    echo 'Success!';
    echo "\n\n";
catch(\SoapFault $e) {
    // Output result
    echo 'SOAP request headers: ' . "\n";
    echo $soapClient->__getLastRequestHeaders() . "\n";
    echo 'SOAP request body: ' . "\n";
    echo $soapClient->__getLastRequest() . "\n";
    echo 'SOAP response headers: ' . "\n";
    echo $soapClient->__getLastResponseHeaders() . "\n";
    echo 'SOAP response body: ' . "\n";
    echo $soapClient->__getLastResponse() . "\n";
    echo "\n";

If the API Connects but the Store Code does not verify

Please see this page in our documentation if the store code is not able to be verified.