I am facing issues while trying to connect to my Magento store using the SOAP API v2. Although the WSDL file opens without any issues in my web browser, I keep receiving errors when attempting to log in to the system.
Code Sample:
$options = array(
'trace' => 1,
'cache_wsdl' => WSDL_CACHE_NONE,
'soap_version' => SOAP_1_2,
'connection_timeout' => 120,
'exception' => 0,
'encoding' => 'utf-8',
);
try {
$client = new SoapClient('http://yourdomain.com/api/v2_soap?type=soap&wsdl=1', $options);
$client->login('user', 'pass');
var_dump($client);
} catch (SoapFault $e) {
var_dump($e);
}
Issue Description:
I encounter an error stating “SoapFault: no XML document found”. After uncommenting the location option, it results in a “SoapFault: Wrong Version” message. Upon reviewing the WSDL file, I see that the soap:address is set to:
<port name="Mage_Api_Model_Server_HandlerPort" binding="typens:Mage_Api_Model_Server_HandlerBinding">
<soap:address location="http://yourdomain.com/index.php/?SID=123abc&type=soap"/>
This appears to be incorrect as it directs to the homepage with a session ID, not the correct API URL.
My Setup:
Using Magento EE version 1.14.
Troubleshooting Steps Taken:
- Disabled local modules
- Tried using Zend_Soap_Client
- Experimented with different URL configurations
- Switched SOAP versions
- Tested on a remote server
- Verified that SOAP is enabled in PHP
- Attempted local WSDL file usage
Does anyone have suggestions for resolving this? I’ve read through multiple threads about these errors, but the solutions offered haven’t helped. Why does my WSDL have an incorrect location?
The incorrect soap:address location you’re seeing is often caused by Magento’s URL generation process picking up session parameters during WSDL creation. I’ve dealt with this exact issue on several EE 1.14 installations. First, check your System > Configuration > Web > Secure/Unsecure settings to ensure base URLs are properly configured without any query parameters. Then examine your index.php file - sometimes modifications or corrupted rewrites can interfere with API URL generation. What worked for me was temporarily disabling SID usage by setting session.use_trans_sid to 0 in php.ini, then regenerating the WSDL. Also verify that your API user has proper role permissions and isn’t being forced through frontend session handling. The session ID appearing in the WSDL location suggests Magento is treating the API request as a frontend session rather than backend API call.
had similar issue few months back with magento ee. check your base_url settings in core_config_data table - sometimes the soap address gets messed up if theres trailing slashes or wrong domain configs. also try clearing var/cache folder completely before testing again.
This looks like a session handling issue with your Magento SOAP configuration. The SID parameter in the WSDL location typically appears when Magento cannot properly manage sessions or when there are URL rewrite problems. I encountered this exact problem on a client’s EE 1.14 installation last year. Try adding ‘use_cookies’ => false to your SoapClient options array and also check if your .htaccess file has the correct rewrite rules enabled. Additionally, verify that your web/cookie/cookie_domain setting in the admin panel matches your actual domain. Sometimes Magento generates incorrect WSDL locations when the cookie domain configuration is mismatched. You might also want to test with a fresh admin user account as corrupted session data can cause these XML parsing errors.