Getting HTTP 406 in Android Webservice Call

后端 未结 3 511
被撕碎了的回忆
被撕碎了的回忆 2021-01-22 13:06

I\'m getting 406 when i invoke the rest web service via android application.Can any one suggest me what is the error in this code and why i am getting this error ??

R

相关标签:
3条回答
  • 2021-01-22 13:33

    406 means that the type of data being requested in the accept header of the request and the type returned by the server don't match. Either change your accepted type or change your return mime type.

    0 讨论(0)
  • 2021-01-22 13:44

    That error is not acceptable.

    Literally.

    Here is some documentation on it:

    It generally means that the service sent stuff back to you in an unrecognizable format. It could be the wrong kind of data, or the headers could just be screwed up. You should try to use a packet sniffer like WireShark to see what is getting sent back. Also, it could be that you just need to specify the content type.

    If you are doing webservice calls, and you've never used a packet sniffer, it would be a great idea to figure out how to do it.

    0 讨论(0)
  • 2021-01-22 13:44

    406 is returned by the server when it can't respond based on accepting the request headers (ie they have an Accept header which states they only want XML). Check the Accept header in response from the server and send the data appropriately.

    0 讨论(0)
提交回复
热议问题