0

I’m relatively new to web development, and I’m amazed at the variety of new concepts in the field. I could probably use some help to synthetize.

I have to deal with is a backend written in Delphi, that provides some poorly written SOAP services. I originally developed an ASP MVC 5 web app making use of the SOAP API. My fatty controllers select and call the SOAP services, use a bunch of Mappers to transform the DTOs into my C#-wise model objects, and execute some business logic at times. Sometimes, they have to use consecutively two mappers, one to transform the DTO into a “model object”, and one to transform the model object into the “view model” object. I know… I’m anxious just thinking about it.

Besides, I wanted to do a Single-page app (at the time, I didn’t even know that this concept existed) with a mix of Razor, JQuery, and a third-party MVC components library (DevExpress).

This project proved to be extremely cumbersome. I managed to bring the monster to life nonetheless, but performances are still an issue, and any modification of the beast requires an excessive amount of time. As an aside, approximately half of my controllers’ methods returns PartialView, and the other half return Json objects.

I recently started creating a “Service” layer, in a separate VS project, whose purpose is to handle the SOAP end point, sometimes execute some business logic, and mostly to do the mapping from DTOs to some model objects (I think I could also introduce some caching here, that’s another debate).

For the web client, I started writing an AngularJs app, which framework indeed simplifies my life a lot. So far I outlined a handful of views, and I can switch from one view to the other in a snap, having total control on the round trips to the server. I had to do little work to outline this new app as compared to my previous approach.

Now I’m left wondering: do I still need ASP MVC? Do I even need ASP at all? Is it possible (is it easy?) to call a SOAP web service from an Angular service? If yes, an extreme solution could be to get rid of ASP, and develop my web app completely in Javascript (Angular).

I immediately see at least one drawback here. My Angular services could only be used in that specific context. Let’s say I want to create a native Android app, it would have to call the SOAP web services and would probably need another Service layer, which probably would do most of what my Angular services layer already does. Moreover, the SOAP end-point, which I didn’t write and is currently only available to the IIS apps on the same server, would need to be exposed to the outside world. It is not ready for that in terms of security.

An intermediate solution could be that I keep my services layer written in C#, and create a REST end-point on top of it, for the use of my angular app as well as various other apps that could be written, in the future, for any platform in any language.

Would this solution mean that I don’t need the “MVC framework” anymore? What would be the role of “ASP” in this context? Only mapping request parameters to .NET objects, and some routing? Let’s not forget about authentication. My previous app used [Authenticate] on every controller as well as some basic roles management. I believe I would have to deal with this “manually” in the context of a REST API?

I also get confused because of things changing so fast. I find information about “Web API” that was true for ASP MVC4, and is no longer true for MVC5. Now, ASP.NET 5 is out, but I wasn’t able to find a clear and comprehensive list of ASP’s features and new features. I also heard of Rails and Node.js, but I’m afraid I currently use a lot ASP features without even knowing

  • WebAPI and MVC's most fundamental differences are their base controller classes, with some additional differences in routing and other features. WebAPI's base controller is tuned towards serving JSON, while MVC's controller is tuned towards serving web pages (though it can certainly be used to purely serve JSON). MVC6 unifies WebAPI and MVC under a single framework, so going forward you will simply use MVC6. – ravibhagw Aug 5 '15 at 14:21
  • Thank you. Well the information I found is that WebAPI and MVC already are unified with MVC5. It seems there is no more API controller, they all inherit from the same base class "Controller". Apparently, with MVC5, the type of the content returned can already be negotiated (examples can be found switching from JSON to XML). – Yugo Amaryl Aug 6 '15 at 9:19
1

Is it easy to call a SOAP web service from an Angular service?

No it is usually not possible because browsers are limited to making requests to the same domain as the webpage is hosted unless you apply some CORS. I have never seen anyone try and call SOAP from javascript. If we ignore the security limitations of the browser any credentials for the service would have to be exposed to all users in javascript and there is no way around this. Also SOAP is a very bloated protocol which doesn't mix well with javascript.

Would this solution mean that I don’t need the “MVC framework” anymore?

Yes

What would be the role of “ASP” in this context?

The role will be the web api. The role of web api is to expose your service layer to the client over the wire by mapping parameters and result and of course some routing.

Let’s not forget about authentication.

Web Api still uses controllers and you can still put [Authenticate] attributes on method and controller class. You just need to decide if you want to use Bearer tokens or Cookies for auth. The more modern approach is using Bearer tokens.

Also REST api means it conforms to richardson maturity level 3 which you may or may not want.

  • Thank you. I think I'm confused because of two things. Firstly, WebAPI has apparently been merged with the MVC5 framework. Secondly, VS 2015 and ASP 5 seem to have a very different approach. When I create a new WebAPI project in VS 2013, I see a Controllers folder and everything, as if I had asked for an MVC project. I tried VS 2015, and only an API folder is scaffolded in the case of an API project, and it seems like no MVC framework is involved by default... – Yugo Amaryl Aug 6 '15 at 9:26
  • Yeah they changed a bunch of things, I've yet to use 2015 that much. In 2013 I usually dont use the mvc or web api templates when creating new project. I use the "Empty" and check web api since the other one includes both web api and mvc which I usually don't need. Is the empty not available any more? – Esben Skov Pedersen Aug 6 '15 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.