Bruce Hunter - 480 - Feb 21, 2014

I am posting to Authenticate with the Header ContentType as the following: 

Accept-Encoding: gzip,deflate
Content-Type: application/xml;charset=UTF-8
Content-Length: 0

I get back the following in the response?

Cache-Control: private
Content-Type: application/json; charset=utf-8
Content-Length: 361
Connection: Close

{“responseStatus”:{“errorCode”:“ValidationException”,“message”:“Validation failed: \r\n – ‘User Name’ should not be empty.\r\n – ‘Password’ should not be empty.”,“errors”:[{“errorCode”:“NotEmpty”,“fieldName”:“UserName”,“message”:"‘User Name’ should not be empty."},{“errorCode”:“NotEmpty”,“fieldName”:“Password”,“message”:"‘Password’ should not be empty."}]}}

I know I’m not setting username and password, but i should get back XML? If i set the url format=xml then i get back xml.

What am I doing wrong? Do we always have to set the url?

For the HTTP request you have to use the “Accept” header.

Bruce Hunter:

My QA department is using SOAP UI for testing and they are setting the Media-Type dropdown. It doesn’t set that I guess.

Here are other ways to ask for the content type: https://github.com/ServiceStack/ServiceStack/wiki/Routing#wiki-content-negotiation

Bruce Hunter:

I got it working, Just added the Accept: “Application/xml” with the Content-Type: the same and all good.

Yep, that’s what “Accept” is there for :slight_smile: