locked
How to implement "Proxy Layer" for OData Service? RRS feed

  • Question

  • User527599268 posted

    Hi,

    I have interested challenge. I have back-end OData Services that are not exposed to internet and cannot be exposed due security reasons. I have to use those services from my MVC application. I am creating Proxy layer that will implement OAuth authentication an will send requests from application UI to back-end services and send response back to UI.  But looks like If I will use OData Web Api as Proxy layer I have to replicate all data models from back-end services in my Proxy service. I do not want to maintenance any data models in my "Proxy". It should be very simple and lightweight. Where to start? 

    Regards,

       Oleg

    Monday, January 8, 2018 4:34 PM

All replies

  • User1120430333 posted

    You can't use the  DTO pattern where the DTO(s) are an abstraction layer, known by the services, service layer and even the MVC solution?

    https://www.codeproject.com/Articles/1050468/Data-Transfer-Object-Design-Pattern-in-Csharp

    https://docs.microsoft.com/en-us/aspnet/web-api/overview/data/using-web-api-with-entity-framework/part-5

    Monday, January 8, 2018 6:35 PM
  • User-474980206 posted

    all the data models should be in their own project, to be shared between service layer and the proxy. the data models should be poco.

    Tuesday, January 9, 2018 1:05 AM
  • User527599268 posted

    My case is more challenging. I do not have control on back-end OData services. I only can call them from Postman and see how response Json looks like. I created Web Api Proxy service and simply converting query string to OData query string than passing to back-end service. Response converting to Json and return from Web Api. I am not sure this is best solution but it is working for GET. 

    Regards,

     Oleg 

    Friday, January 12, 2018 3:55 PM
  • User283571144 posted

    Hi styxol,

    styxol

    My case is more challenging. I do not have control on back-end OData services. I only can call them from Postman and see how response Json looks like. I created Web Api Proxy service and simply converting query string to OData query string than passing to back-end service. Response converting to Json and return from Web Api. I am not sure this is best solution but it is working for GET. 

    According to your description, it seems you have already achieve your requirement.

    In my opinion, this design may have performance issue.

    When the client wants to get the data, actually two requests will be made for getting data.

    One request is sent by the client user, another is sent by the "proxy layer".

    Best Regards,

    Brando

    Tuesday, January 23, 2018 9:04 AM