9

I have looked through some questions, technologies for building a good service layer but I have some questions regarding this that I need help with.

First some information of what I have for requirements. We currently have a number of web applications that talk to each other in a spiderweb looking way (all talking to each other in a confusing way via webservices and database data).

  • We want to change this so that all applications go through a service layer where we can work more with cache and encapsulate common functionality and more.
  • We want this layer to also have a Web API so that 3rd party clients can consume information from the service.

The problem I see is that if we build the service layer with say MVC4 Web API don't we need to communicate between the application using the webAPI meaning we have to construct URLs and consume JSON/Xml. That does not sound too effective. I assume a better method would be working with entities and WCF to communicate between the application but then we might loose the Web API magic?

So the question is if there is a way to consume a service layer as both a Web API (JSON/XML) and as a more backend service layer with entities. If we are forced to use 2 different service layers we might have to duplicate some functionality and other bad things.

Hope the question is clear enough and please ask if you need any more information.

1
  • Good question. +1 for that!
    – Kangkan
    Commented Mar 29, 2012 at 9:39

1 Answer 1

1

For a set of applications that are hosted on intranet and possibly in one LAN, the best can be a TCP connection for services.

In that sense, I shall suggest, creating a service application that expose a set of endpoints and service interfaces that can work on TCP. These can be consumed by the home-grown or trusted applications.

The service application whould have another set of endpoints and service interfaces that are exposed for consuming over web (web API).

So the service application can be hosted using WCF and endpoints/interfaces shoukd be added in accordance to the need.

3
  • So creating 1 set of endpoints for the internal communication and 1 set for Web API? (And yes its on LAN with about 20 servers inkluding intranet, externalwebs and such)
    – Swippen
    Commented Mar 29, 2012 at 9:24
  • Ok reading up some more on WCF (sorry I am a bit of a beginner in these waters) so I have have the same services or the same service application but then use different endpoints for that service so the service application can be used via both TCP and HTTP, correkt? Maybe a tougher question.. anyone have any information on the MVC4 web API if that can be consumed via TCP?
    – Swippen
    Commented Mar 29, 2012 at 9:37
  • You are getting it right. On MVC4 web API, I have not read anything yet. You might need to read about it.
    – Kangkan
    Commented Mar 29, 2012 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.