Sie sind auf Seite 1von 21

REST

Web Services Web services are application components Web services communicate using open protocols Web services are self-contained and self-describing Web services can be discovered using UDDI Web services can be used by other applications HTTP and XML is the basis for Web services

Web Services have Two Types of Uses Reusable application-components. There are things applications need very often. So why make these over and over again? Web services can offer application-components like: currency conversion, weather reports, or even language translation as services. Connect existing software. Web services can help to solve the interoperability problem by giving different applications a way to link their data. With Web services you can exchange data between different applications and different platforms.

What is SOAP?
SOAP is an XML-based protocol for exchanging information between computers. SOAP is acronym for Simple Object Access Protocol SOAP is a communication protocol SOAP is designed to communicate via Internet SOAP can extend HTTP for XML messaging SOAP provides data transport for Web services SOAP can exchange complete documents or call a remote procedure SOAP can be used for broadcasting a message SOAP is platform and language independent SOAP is the XML way of defining what information gets sent and how

What is Rest?
REST stands for Representational State Transfer. It relies on a stateless, client-server, cacheable communications protocol -- and in virtually all cases, the HTTP protocol is used. REST is an architecture style for designing networked applications. A Uniform Resource Locator (URL) is used to identify and expose a Restful service. This is a logical name that separates the identity of an information resource from what is accepted or returned from the service when it is invoked. Restful applications use HTTP requests to post data (create and/or update), read data (e.g., make queries), and delete data. Thus, REST uses HTTP for all four CRUD (Create/Read/Update/Delete) operations.

Using Web Services and SOAP, the request would look something like this:
<?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soapencoding"> <soap:body pb="http://www.acme.com/phonebook"> <pb:GetUserDetails> <pb:UserID>12345</pb:UserID> </pb:GetUserDetails> </soap:Body> </soap:Envelope>

And with REST? The query will probably look like this:
http://www.acme.com/phonebook/UserDetails/12345

A REST service is: Platform-independent Language-independent Standards-based REST is best used to manage systems by decoupling the information that is produced and consumed from the technologies that do so. We can achieve the architectural properties of: Performance Scalability Generality Simplicity Modifiability

Key components of a REST architecture:


REST uses a resource identifier to identify the particular resource involved in an interaction between components. REST connectors provide a generic interface for accessing and manipulating the value set of a resource. REST components perform actions with a resource by using a representation to capture the current or intended state of that resource and transferring that representation between components. A representation is a sequence of bytes, plus representation metadata to describe those bytes. A representation consists of data, metadata describing the data

REST uses various connector types to encapsulate the activities of accessing resources and transferring resource representations. The connectors present an abstract interface for component communication, enhancing simplicity by providing a complete separation of concepts and hiding the underlying implementation of resources and communication mechanisms.

CRUD with Rest