The Service Oriented Architecture (SOA) is not a technology instead it is a collection of Services. Precisely it is an architectural style for building business applications using loosely coupled services which communicates with each other.
SOA = Messages + Services
Services – Self-contained business functionality and communicate using messages.
Messages – It is a discrete unit of communication. It should be cross-platform, secure, asynchronous, reliable, follow the industry standard, and able to describe and discover the service.
The SOA shifts your thinking from classes and objects to messages.
The webservice is nothing but a service available over the web (Or method of communication between two devices over a network) while API (Application Programming Interface) acts as an interface between two different applications so that they can communicate with each other. The API may or may not be web-based. Having said that all the all the web services are APIs but all APIs are not web services. The webservice always needs a network while for API it may/may not be needed.
WebServices are mainly of two types
Let’s understand the differences between SOAP and REST
- SOAP stands for Simple Object Access Protocol. REST stands for Representation State transfer.
- SOAP is an XML based protocol which uses WSDL for communication between source and recipient. REST is an architecture style protocol which uses XML and JSON to communicate between consumer and provider.
- SOAP uses RPC while REST directly uses URL.
- The transfer is over HTTP, FTP, SMTP and other protocol for SOAP while for REST it is HTTP only.
- SOAP is hard to implement over REST.
- The performance is slower compared to REST.
- SOAP is more secure since it does define its own security. The REST is less secure. The transport defines the security. (Smart consumer and provide while dumb pipe).
The SOAP message is large. The core element of SOAP message is a SOAP envelope. The SOAP envelope defines the start and end of the message. It has two parts 1. SOAP HEADER 2. SOAP BODY
WSDL – Web Service Description Language
The WSDL is an XML based interface that is used to describe the functionalities of the webservices .