2. Agenda
WEB SERVICES SOAP vs REST
ADVANTAGESHTTPS
HTTP Methods
Resource AugPAYLOAD
RESTFUL WEB
SERVICE
3. A Web Service is can be defined by following ways:
• is a client server application or application component for communication
• method of communication between two devices over network.
• is a collection of standards or protocols for exchanging information between
two devices or application.
About Web Services
4. • There are mainly two types of web services -
TYPES OF WEB SERVICES
5. SOAP
• Stands for simple object access
protocol
• SOAP is a protocol
• SOAP define standard to be strictly
followed
• SOAP can’t use REST because it a
protocol
• SOAP define xml format only
SOAP v/s REST
REST
• REST stands for Representational
State Transfer
• REST is a architectural Style
• REST doesn't define to much
standard like SOAP
• REST can use SOAP web services
because it is a concept and can use
any protocol like HTTP, SOAP.
• REST permits different data format
such as Plain text, HTML, XML,
JSON etc.
6. Restful Web Services
• A web service is a collection of open protocols and standards used for
exchanging data between applications or systems.
• Web services based on REST Architecture are known as RESTful Web
Services
• Rest web services use HTTP methods to implement the concept of REST
architecture. A RESTful web service usually defines a URI (Uniform
Resource Identifier), which is a service that provides resource
representation such as JSON and a set of HTTP Methods.
7. ADDRESSING
• Addressing refers to locating a resource or multiple resources lying on the
server.
• Each resource in REST architecture is identified by its URI (Uniform
Resource Identifier). A URI is of the following format −
• “<protocol>://<service-name>/<ResourceType>/<ResourceID>”
• Purpose of an URI is to locate a resource(s) on the server hosting the web
service.
8. HTTP METHOD
The following HTTP methods are most commonly used in a REST based
architecture.
▪ GET − Provides a read only access to a resource.
▪ POST − Used to create a new resource.
▪ DELETE − Used to remove a resource.
▪ PUT − Used to update an existing resource or create a new resource.
9. GET
• The GET method is used to retrieve information from the given server using
a given URI. Requests using GET should only retrieve data and should have
no other effect on the data.
10. POST
• the POST request method requests that a web server accept the data
enclosed in the body of the request message, most likely for storing it..
11. PUT
• Replaces all current representations of the target resource with the
uploaded content.
12. DELETE
• Removes all current representations of the target resource given by a URI.
13. STATELESSNESS
• RESTful Web Service should not keep a client state on the server. This
restriction is called Statelessness
• It is the responsibility of the client to pass its context to the server and then the
server can store this context to process the client's further request.
• Consider the following URL −
• “http://localhost:8080/UserManagement/rest/UserService/users/1”
• If you hit the above url using your browser or using a java based client or using
Postman, result will always be the User XML whose Id is 1 because the server
does not store any information about the client
• Display the Result in XML format
<user><id>1</id><name>xyz</name></user>
ADVANTAGE OF RESTFUL WEB
SERVICES
14. SECURITY
• As RESTful Web Services work with HTTP URL Paths, it is very important to
safeguard a RESTful Web Service in the same manner as a website is
secured.
• Following are the best practices to be adhered to while designing a RESTful
Web Service −
• Session Based Authentication − Use session based authentication to
authenticate a user whenever a request is made to a Web Service method.
• Validate Malformed XML/JSON − Check for well-formed input passed to a
web service method.
• No Sensitive Data in the URL − Never use username, password or session
token in a URL, these values should be passed to Web Service via the POST
method.
ADVANTAGE OF RESTFUL WEB
SERVICES
15. • The Payload section describes the data the server returns in response to a
request.
• The Payload return the data in JSON , XML or Text.
PAYLOAD
16. • XML Stands for eXtensible Markup Language.
• XML is a markup language much like HTML.
• XML was designed to store and transport data.
• XML uses more words than necessary
▪ Example of XML –
XML
17. • JSON Stands for JavaScript Object Notation.
• JSON is a syntax for Storing and exchanging data.
• JSON files are more human readable than XML.
• Example of JSON format-
JSON
18. Thank you
Thank You
Thankyou
GenX Info Technologies Pvt. Ltd.
411, 4th Floor, Bestech Cyber Park
National Highway-8
Gurgaon, Haryana, INDIA
www.gen-xt.com, sales@gen-xt.com
+91-124-2656001, +91-9810402267