Can we implement SOA style in MVC architecture

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

+4
source share
3 answers

In an SOA application, you usually do not include an interface (presentation layer). You consume these services in your MVC application, or better yet, in a separate β€œmodel” project that uses the MVC application.

Data Access β†’ Business Logic β†’ Services β†’ Models β†’ MVC

The goal is to use services to create an abstraction around the base of your application, to allow multiple clients to use these services.

+6
source

I tend to think of a model presented at the client / presentation level as a ViewModel, it's just a representation of the layers of the model's presentation. Not the actual domain model. This is necessary in SOA, because the context of the consumer model often changes.

In SOA, we are trying to move to the canonical scheme for the contract, since it is likely that not all customers will need the exact view of the model now and in the future.

Thus, whether it is a web client, a service client, or a desktop client, if you think of a model in MVC as a ViewModel, this allows you to abstract view-level objects from service-level things, and you approach a canonical scheme.

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

Examples of building such a service stack can be found here:

SOA Design Pattern

Deciding whether to go with a REST architecture or full WS- * SOAP is a separate issue and should not affect your choice of MVC as your presentation template.

Of course, there may be other restrictions that preclude the use of one or the other.

Choosing a presentation template for a new or corporate web development on the Microsoft platform is a difficult task, in my opinion, there are only three; View Model, Model-View-Presenter (MVP) or ASP.NET MVC (derived from Model2).

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

+4
source

It depends on what you mean by SOA. If you mean WS- * standards, I would not recommend MVC since you will need to write a lot of plumbing to make it work.

If you are looking for something like a REST service, then the MVC pattern actually works. The request is the HTTP address of the resource, which is passed to the controller, which loads the data through the model, and then passes it to the view, which returns it in any form (JSON, XML, Binary, etc.). Or you can often return the result directly, depending on what structure you use.

Eric

+1
source

All Articles