Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Response headers are of type 'text/html' but should be of type 'text/xml' #3

Closed
adrianlogue opened this issue Oct 7, 2012 · 0 comments

Comments

@adrianlogue
Copy link

For the most part this issue doesn't affect that many SOAP clients, but I have observed that some .NET SOAP clients attempting to consume a web service from Silverstripe will fail with the following error:

Client found response content type of 'text/html; charset="utf-8"', but expected 'text/xml'.
The request failed with an empty response.

The solution is simply to explicitly set the content type in the index() action with a line of code like this:

$this->getResponse()->addHeader("Content-Type", "text/xml; charset=utf-8"); 

Note that a similar explicit setting of the header already occurs in the wsdl() action, I believe it is an oversight that it isn't also in the index() action.

Thanks & regards,
Adrian Logue

@xini xini closed this as completed in 470e719 Apr 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant