Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we implement SOA style in MVC architecture

Is to possible to have a layout for web-based architecture based on MVC where SOA is the architectural style. Or to rephrase, can services be part of the M,V, C of MVC.If so, what kinds of services can be included in each of them. Also, can you give me a real world example?

like image 404
rbp Avatar asked Nov 05 '10 23:11

rbp


2 Answers

In a SOA application you are typically not including the front end (presentation layer). You are consuming those services in your MVC application, or better yet in a separate "model" project that the MVC application uses.

Data Access -> Business Logic -> Services -> Models -> MVC

The point is to use the services to create an abstraction around the base of your application to allow for multiple clients to consume those services.

like image 98
Dustin Laine Avatar answered Sep 30 '22 04:09

Dustin Laine


I tend to term the Model as represented in the client/presentation layer as the ViewModel, it is simply the presentation layers view of the model. Not the actual Domain model.This is needed in a SOA as the context of the consumer of the Model changes often

In SOA`s we try to get to a canonical schema for the contract, as it is quite likely that not all clients now and in the future will require the exact same view of the model.

Thus be it a web client, service client or a desktop client, if you think of the Model in MVC as the ViewModel, this allows you to abstract presentation layer things away from Service layer things, and you get closer to a canonical schema.

So an example View >> Controller >> ViewModel(Model) >> Data Contract >> Service

Examples of how to build a service stack like this can be found here:

SOA Design Pattern

The decision of whether to go with a REST architecture or a full WS-* SOAP is a separate concern and should not affect your choice of MVC as a presentation pattern.

There may of course be other constraints that preclude the use of one or the other.

Choosing a presentation pattern for a new or enterprise web development on the Microsoft platform is a daunting task, in my opinion there are only three; View Model, Model-View-Presenter (MVP) or ASP.NET MVC (a Model2 derivative).

You can read the full article here ASP.NET MVC Patterns

like image 37
MetalLemon Avatar answered Sep 30 '22 03:09

MetalLemon