My understanding of a webservice and service layer is as follows -

Service Layer: An abstraction layer which exposes a set of common operations which can be used by multiple consumers. For instance , I have a database containing customer data. Multiple applications may want to add / update / delete data in this data store. Each application will have logic to add / update / delete data in data store - hence duplication of logic. Instead, I would provide a service layer which exposes methods to add / update / delete customer information. So the logic isn't duplicated any longer and the applications have to just use my service layer in order to perform these activities. The specific domain where the service layer operates here is on customer information.

Webservices: Any machine to machine data transfer over the web can be performed using webservices. The implementation of webservice can be SOAP, REST, vanilla RMI, etc... and the data can be serialized as XML, JSON, binary, etc... Assuming I expose a SOAP based webservice for the use case listed in my example above, I could provide a SOAP or REST based interface to add / delete / update customer information. The domain here is customer as well.

Based on my understanding, I feel that webservices are a subset of the service layer. The implementation for the example use case can be provided in the form a java .jar file or DLL which provides relevant APIs to perform the activity. All of the required applications will have to download the appropriate .jar or DLL to perform actions on customer data. Whereas webservice is specifically for machine-machine communication over web.

Is my understanding correct?


3 Answers 3


A service layer is a layer in an application that hides away specific implementation details for a system and provides a uniform and consistent interface to the operations in that system.

A webservice is a communication pattern between devices.

The service layer defines a boundary for your system where external systems can interact with it. If you do this purely in code by providing a DLL, other systems interface with your service layer directly. Alternatively, you can provide a webservice on top of your DLL in which case other systems interface with the webservice, which interfaces with the DLL.

Compare this to a shop that has both a physical counter and an online store. Your salespeople are the 'service layer': they 'hide away' the implementation details that deal with registering a sale in the Point of Sale register, they handle the procedures that deal with performing additional purchases for a product that is out of stock, they put the cash from the customer in the right place and so on.

In the online store, your website acts as a 'web service': a customer no longer has to talk to a salesperson but instead places an order through the website. That order gets passed to a salesperson, who again performs the same things as outlined. The communication pattern is different, but the customer only cares about getting the product and knows that he has a variety of ways to do that.

  • Thank you! Why am I not able to reward 50 bounty points? I clicked on +50 icon but it is disabled. Commented Nov 16, 2015 at 14:20
  • It should do that automatically once the bounty expires, apparently... programmers.stackexchange.com/help/bounty
    – JDT
    Commented Nov 16, 2015 at 14:48
  • Thanks . I have in the past clicked on it and the points were awarded - so was a bit confused. Thanks again Commented Nov 16, 2015 at 15:38
  • finally was able to award :) Commented Nov 17, 2015 at 17:00

A web service is a service, available on a web-based network, i.e. accessible using HTTP (not necessarily over the internet).

A service is a logical unit of software, deployed on a particular location in a network, meant to be used by other software units.

A service layer is an architectural layer, consisting of logically related services.


Web service

In the pre-REST era, the most accepted definition of web service was the definition given by W3C

A Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP-messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.

Nowadays, the term is also used for REST-compliant services, so this definition needs to be broadened. The word "Web" is derived from the World-Wide Web, so it is a web like www, i.e. based on HTTP, but not necessarily world-wide. That's why I think the distinction between a web service and all other services is, that a web service can be accessed via HTTP.


A service is the main entity of a service-oriented architecture.

Services, components and objects all share the properties of being loosely coupled units of software, offering a set of logically related methods, hiding their implementation behind an interface. Components/objects are included in applications as JARs, DLLs, or whatever. In other words, each application runs its own instances.

Services are different from components/objects in the sense that they are deployed separately. Multiple applications may use the same instance of the service. Each service has its own network location. This is comparable to what is meant by SaaS (Software as a Service): instead of shipping a copy of the software to the customer, multiple customers access the same service(s) via the internet.

Services typically consist of one or more components and components consist of one or more objects (see wikipedia).

Service layer

This is a combination of the word 'service', as defined above, and the word 'layer', which refers to one abstraction layer in a layered architecture. Typically, a central database is encapsulated by a number of services: each service in that layer may access the database, but all other software should access the database through that layer. However, services are not necessarily organized in service layers. On the contrary, to increase the independence of services, it would be better to let every service have its own storage, unaccessible by other services (although there may be reasons to relax this principle). A SOA usually does not have a service layer, but a network of services.

  • I have reworded the paragraph about components. Commented Nov 13, 2015 at 21:58

Service layer is a set of business functions available in an application. And it's more of a logical boundary.

Usually these functions are exposed in an application using one or more endpoints such as UI, webservice or data import job.

So a Web service is not a subset of a service layer, but it's one way of exposing it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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