jsonwso2wso2-data-services-server

How set default output type to JSON ins DSS


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.


Solution

  • 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'