cancel
Showing results for 
Search instead for 
Did you mean: 

Wsi ContentType setHeaders and C# Service Reference

Wsi ContentType setHeaders and C# Service Reference

 Hello guys.

 

I'm using a C# Service Reference to integrate with Magento 1.9.2.1, and I was getting an error like this:

 

 

Which translates to:

 

The content type application/xml;charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8)

 

So upon further investigation I found someone with the same problem here:

 

http://magento.stackexchange.com/questions/42536/problems-calling-magento-soap-v2-service-in-c

 

Essentially the guy who answered, instructed to change this line (in app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php):

 

->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)

To this:

 

->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset, true)

 

This is the ContentType header before the change:

  

 

And this is after:

 

 

 

I googled a bit and found that the header takes only a single media type and subtype.

 

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17

 

 Is this right? Can I safely change the setHeaders() call in Soap.php?