Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering ASP.NET Web API

You're reading from   Mastering ASP.NET Web API Build powerful HTTP services and make the most of the ASP.NET Core Web API platform

Arrow left icon
Product type Paperback
Published in Aug 2017
Publisher Packt
ISBN-13 9781786463951
Length 330 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Malendra Hurbuns Malendra Hurbuns
Author Profile Icon Malendra Hurbuns
Malendra Hurbuns
Mithun Pattankar Mithun Pattankar
Author Profile Icon Mithun Pattankar
Mithun Pattankar
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Introduction to Microservices and Service-Oriented Architecture FREE CHAPTER 2. Understanding HTTP and REST 3. Anatomy of ASP.NET Core Web API 4. Controllers, Actions, and Models 5. Implementing Routing 6. Middleware and Filters 7. Perform Unit and Integration Testing 8. Web API Security 9. Integration with Database 10. Error Handling, Tracing, and Logging 11. Optimization and Performance 12. Hosting and Deployment 13. Modern Web Frontends

Services in SOA

A service is a piece of software which provides a functionality to other pieces of software within your system or outside the system.

The other pieces of software (clients) could be anything from a web application (website) to a mobile app (native or hybrid), or a desktop app, or even another service which uses another service in order to carry out a particular type of functionality.

In an e-commerce website context, when a user places an order, the web application communicates with the service to carry out the create, read, update, and delete (CRUD) operations on the database.

The communication between the software components (clients) and the service normally happens over a network with some kind of a communication protocol, for example, a mobile app communicating to a service via internet.

A system which uses a service or multiple services in this fashion, is known to have a Service-Oriented Architecture.

The main idea behind this architecture is that, instead of using modules within each client application, it lets us use a service(s) to provide functionality to them. This allows us to have many client applications using the same functionality.

SOA was successful, because of its following characteristics:

  • It allows us to scale our software when the demand increases by enabling it to have a copy of the service on multiple servers, so when the traffic comes in, a load balancer redirects that request to a specific instance of the service, and we can have multiple instances of the service. Thus, when the demand increases, increasing the number of instances on the servers helps us scale it.
  • SOA boasts of having standardized contracts or interfaces. When a client application calls the service, it calls the service by calling a method. The signature of that method normally doesn't change when the service changes, so we can upgrade our service without having to upgrade our clients as long as the contract and the interface do not change.
  • Services are, in fact, stateless, so when a request comes in from a website to our service, that instance of the service does not have to remember the previous request from that specific customer. It, basically, has all the information from the request that it needs in order to retrieve all the data associated with the previous requests within the service, so, the service does not have to remember the previous calls a client has made to that particular instance of the service.

Service implementation

SOA gained popularity due to its implementation of services, which are accessible over standard internet protocols that are independent of OS platforms and programming languages.

Services from a developer POV are nothing but web services hosted on a web server, and which use SOAP (Simple Object Access Protocol) or JSON for communication. It's interesting to know that a web service can be used as a wrapper for legacy systems for making them network-enabled.

Some of the popular technologies implementing services (SOA) are as follows:

  • Web services based on WSDL (Web Service Description Language) and SOAP
  • Messaging, for example, with ActiveMQ, JMS, and RabbitMQ
  • WCF (Microsoft's implementation of Web services)
  • Apache Thrift
  • SORCER
  • RESTful HTTP

Service-Oriented Architecture started gaining momentum when the Monolithic architectural approach experience proved to be more painful than thought earlier. Let's briefly understand what Monolithic systems are and their drawbacks that led to adoption of SOA.

You have been reading a chapter from
Mastering ASP.NET Web API
Published in: Aug 2017
Publisher: Packt
ISBN-13: 9781786463951
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime