This error message prevents any communication with the Magento API from working

This error is a result of the webserver providing two content-types as a response to an API SOAP v2 login request.  Having two content-types does not meet the HTTP standard, which results in the standard components parsing this into a single content-type that is not understood.


Instead of a valid response content-type = “text/xml; charset=utf-8”, the response type is made up of a concatenation of both of the servers specified content-types = “text/xml; charset=utf-8,text/xml; charset=UTF-8”.
 
The only way resolve this issue is for the server settings to be modified so that the response header includes only one content-type setting.


SOAP Header Character Set Fix

(1) Using a ftp client, download  app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php

(2) Create a folder structure as such. app/code/local/Mage/Api/Model/Server/V2/Adapter

  • Note: The only difference in the file structure is “core” is being replaced by “local” 
(3) Edit the Soap.php File previously downloaded and add the following changes listed below.                   


Line 52:      ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
Change to:
                  ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset, true)

 Line 75:     ->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset)
Change to:
                 ->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset, true)

Save Changes


(4) Upload the file to app/code/local/Mage/Api/Model/Server/V2/Adapter & delete the Soap.php located on your computer. This is a safety measure to prevent different files with the same name getting mixed up. (You’ll see further into the guide).

(5) There is a WS-I compliant SOAP adapter that will need the same update. Using a ftp client, download app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php

(6) Create a folder structure as such. app/code/local/Mage/Api/Model/Server/V2/Adapter                                          

  • Note: The difference in the file structure is “core” is being replaced by “local” & instead of V2, we’re adding Wsi. 

(7) Edit the Soap.php File previously downloaded from the Wsi/Adapter folder and add the following changes listed below.
 
Line 52:      ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
Change to:
                  ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset, true)

 Line 96:     ->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset)
Change to:
                 ->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset, true)

Save Changes
 
(8) Upload the file to app/code/local/Mage/Api/Model/Server/ Wsi/Adapter/