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 ??
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.
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.
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.