written 6.7 years ago by |
Web Service - Web Services work on client-server model where client applications can access web services over the network. Web services provide endpoint URLs and expose methods that can be accessed over network through client programs written in java, shell script or any other different technologies. - Web services are stateless and doesn’t maintain user session like web applications.
Advantages of Web Services
1. Interoperability:- Web services are accessible over network and runs on HTTP/SOAP protocol and uses XML/JSON to transport data, hence it can be developed in any programming language. Web service can be written in java programming and client can be PHP and vice versa.
2. Reusability:- One web service can be used by many client applications at the same time.
3.Loose Coupling:- Web services client code is totally independent with server code, so we have achieved loose coupling in our application.
4. Easy to deploy and integrate, just like web applications. 5. Multiple service versions can be running at same time.
Different types of Web Services
There are two types of web services:
- SOAP Web Services: Runs on SOAP protocol and uses XML technology for sending data. - Restful Web Services: It’s an architectural style and runs on HTTP/HTTPS protocol almost all the time. REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services.
REST Web Services
- REST is the acronym for REpresentational State Transfer. REST is an architectural style for developing applications that can be accessed over the network.
- REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services. REST doesn’t specify any specific protocol to use, but in almost all cases it’s used over HTTP/HTTPS.
- When compared to SOAP web services, these are lightweight and doesn’t follow any standard. We can use XML, JSON, text or any other type of data for request and response.
Advantages of REST web services
- Learning curve is easy since it works on HTTP protocol
- Supports multiple technologies for data transfer such as text, xml, json, image etc.
- No contract defined between server and client, so loosely coupled implementation.
- REST is a lightweight protocol
- REST methods can be tested easily over browser.