Is MVC RESTful by Design

Should MVC be RESTful?

Is there a way to make a SOAP service using an MVC ?

Will the input request actually go to View first and then to Controller and then Model for example:

 Request -> View -> Controller -> Model 

but at the same time, this is no longer an MVC pattern. (is that right right?)

How else could we get a typed response using SOAP , but still stick to the MVC (or be close). Could MVVM be a more appropriate template for this situation?

+6
source share
3 answers

REST describes how you interact with the application, and MVC describes how to implement the application. An application implemented using MVC can be RESTful or not.

SOAP is a protocol for interacting with an application that can be implemented using MVC.

In MVC, the request goes to the controller, which creates the model for presentation.

 Request -> [Controller] -> Model -> [View] -> Response 
+21
source

The request is routed to an action on your controller that uses the model (which you define is just a structure that represents the data that your actions and presentation will act). This action returns an ActionResult , which is often, but not required, a ViewResult (which essentially just executes the specified view page using the specified model, if any). However, you do not need to return the View; You can create any kind of ActionResult that you want. You can return XML, JSON, SOAP, binary content, whatever.

MVC retains its nature, but it does not strictly adhere to REST and can be adapted to what you consider necessary. You could say that your controller says SOAP, but my question is: why would you, if this work has already been done for you in other technologies (for example, WCF)?

0
source

HTTP was designed as RESTful. A detailed discussion of what REST is here . MVC has no limits to be RESTful or not. ASP.Net MVC supports the REST web development style. Whether you can make your website RESTful or not is your choice. SOAP protocol is a protocol. In .Net, it is better to use WCF to work with SOAP. WCF services can be deployed with your ASP.Net MVC application. But we do not have an MVC implementation inside WCF. In general, we don’t have a user interface part in Web / WCF services at all.

0
source

Source: https://habr.com/ru/post/908421/


All Articles