Getting Started - Background Concepts

Different ways for getting started with ServiceStack: Project templates, Walkthroughs, Docs and Videos, choose what's best for you

Learn

What is a Message-based WebService?

Message-based design is enabled in ServiceStack by capturing the Services Request Query into a Request DTO that’s completely de-coupled from any one implementation.

Diagram for the role of DTOs Diagram for the role of DTOs

There are many natural benefits gained when adopting a message-based design they offer better resilience, flexibility, versionability than their RPC cousins. Most of the benefits of message-based designs are gained over time as you’re developing and evolving your existing services and adding support for more clients. One immediate benefit is being able to provide an end-to-end typed API without the use of code-gen. This is impossible to achieve without a message-based design which ensures the essence of your Service Contract is captured in re-usable DTOs.

Conceptually in ServiceStack you’re just sending a message to a ServiceStack instance, the client is not concerned with what ultimately handles it, only that a response is returned for reply requests or that the request is successfully accepted for oneway messages. In a RPC API you’re conceptually invoking a remote method which has the request tightly coupled to its remote implementation method signature.

API First Development

The message based approach ServiceStack takes goes hand in hand with API first development. Having well-defined, coarse-grained Service Contracts which are made up from decoupled, implementation free message DTO, enables a client agnostic API for all client types since they all consume the same published APIs as each other.

If your Services retain this property then they’ll be able to encapsulate any of its capabilities of infinite complexity and make it available remotely to all consumers with never any more complexity than the cost of a Service call.

This is ultimately where most of the value of Services are derived, they’re the ultimate form of encapsulating complexity and offers the highest level of software reuse. ServiceStack amplifies your Services capabilities by making them available in multiple Hosting Options, serialization formats, MQ and SOAP endpoints to enable more seamless integrations in a variety of different scenarios including native end-to-end Typed APIs for the most popular Web, Mobile and Desktop Apps that reduce the effort and complexity required to call your Services in all consumers - multiplicatively increasing the value provided.

ServiceStack architecture

Architecture Overview

Ultimately behind-the-scenes ServiceStack is just built on top of ASP.NET’s Raw IHttpAsyncHandler. Existing abstractions and xmlconfig-encumbered legacy ASP.NET providers have been abandoned, in favour of fresh, simple and clean Caching, Session and Authentication providers all based on clean POCOs, supporting multiple back-ends and all working seamlessly together.

ServiceStack’s Message-based design allows us to easily support typed, generic and re-usable Service Clients for all our popular formats. Having all clients share the same interface allow them to be hot-swappable at run-time without code changes and keep them highly testable where the same unit test can also serve as an XML, JSON, JSV, SOAP Integration Test.

ServiceStack architecture