1

We have a mobile app using Restkit which would use as WSO2 DSS service as the backend of the app. The service has a database data source. However the developer is complaining that he gets an error that the service is only returning text/plain format. The service has a JSON output type and mapped on a json format. He said that in reskit it does not send the sevice the header content type but it is expecting a json output format. Is there anyway I can set DSS default output type as json output. I've already tried all the solutions in the net but still getting same error.

Drew
  • 710
  • 1
  • 15
  • 34

2 Answers2

3

Normally JSON return handled by httpContentNegotiation parameter on 'axis2.xml' and in 'axis2_client.xml'.

  <parameter name="httpContentNegotiation">true</parameter>

So simply you can set content request header with

   Accept:application/json

ex:

 curl -v -H "Accept:application/json" 'your_path'
Dakshika
  • 1,694
  • 1
  • 14
  • 18
  • I already told the developer that the solution was that. I even showed them the articles and documentation but they are insisting that Restkit has no way to tell the service that it wants a json formatted output. They are telling that the service should ouput a default json format – Drew Sep 01 '14 at 06:29
1

If you are using restkit make sure to add a custom header to http request. You need to set the Accept header as mentioned above. Please find this link.

Dilshan
  • 3,231
  • 4
  • 39
  • 50