locked
OData and Jsonp RRS feed

  • Question

  • User367642263 posted

    Hi guys

    I am struggling to get my OData Web Service to return jsonp result when it is required. 

    Looks like all custom solutions are working well for normal Web API Service, but OData does not provide any flexibility to override the response.  

    I tried to use WebApiContrib.Formatting.Jsonp lib or custom JsonpFormatter  (adding config.Formatters.Insert(0, new JsonpFormatter()) in WebApiConfig) - not luck. 

    I am still using OData v3, because we have to provide atom xml for some applications.

    Thanks

    Friday, July 14, 2017 2:58 AM

All replies

  • User1168443798 posted

    Hi vladnech,

    Could you share us the reason you need jsonp?

    After checking the supported format for Odata, it seems it supports XML and Json.

    As my understanding, we usually used Jsonp for CORS issue. If so, I would suggest you try add CORS headers to enable CORS.

    #How to enable CORS in Odata .NET service?

    https://forums.asp.net/t/2032931.aspx?How+to+enable+CORS+in+Odata+NET+service+

    Best Regards,

    Edward

    Friday, July 14, 2017 5:08 AM