Presentation is loading. Please wait.

Presentation is loading. Please wait.

Prepared By : Monika Darji Web Services using REST & JAX-WS.

Similar presentations


Presentation on theme: "Prepared By : Monika Darji Web Services using REST & JAX-WS."— Presentation transcript:

1 Prepared By : Monika Darji Web Services using REST & JAX-WS

2 Prepared By : Monika Darji REST stands for REpresentational State Transfer The term Representational State Transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertationRoy Fielding It is an architectural style, not a toolkit. Resources are identified by uniform resource identifiers (URIs) Resources are manipulated through their Representations. Messages are self-descriptive and stateless Example of a RESTful request: POST /users HTTP/1.1 Host: myserver Content-Type: application/xml Robert

3 Prepared By : Monika Darji The basics REST defines a set of architectural principles by which you can design Web services that focus on a system's resources, including how resource states are addressed and transferred over HTTP by a wide range of clients written in different languages. If measured by the number of Web services that use it, REST has emerged in the last few years alone as a predominant Web service design model. In fact, REST has had such a large impact on the Web that it has mostly displaced SOAP- and WSDL-based interface design because it's a considerably simpler style to use. A concrete implementation of a REST Web service follows four basic design principles: 1.Use HTTP methods explicitly. 2.Be stateless. 3.Expose directory structure-like URIs. 4.Transfer XML, JavaScript Object Notation (JSON), or both.

4 Prepared By : Monika Darji Use HTTP methods explicitly. REST asks developers to use HTTP methods explicitly and in a way that's consistent with the protocol definition. This basic REST design principle establishes a one-to- one mapping between create, read, update, and delete (CRUD) operations and HTTP methods. According to this mapping: * To create a resource on the server, use POST. * To retrieve a resource, use GET. * To change the state of a resource or to update it, use PUT. * To remove or delete a resource, use DELETE.

5 Prepared By : Monika Darji Be stateless A REST Web service application (or client) includes within the HTTP headers and body of a request all of the parameters, context, and data needed by the server-side component to generate a response. Statelessness in this sense improves Web service performance and simplifies the design and implementation of server-side components because the absence of state on the server removes the need to synchronize session data with an external application.

6 Prepared By : Monika Darji Expose directory structure-like URIs\ REST Web service URIs should be intuitive to the point where they are easy to guess. Think of a URI as a kind of self- documenting interface that requires little, if any, explanation or reference for a developer to understand what it points to and to derive related resources. To this end, the structure of a URI should be straightforward, predictable, and easily understood. Transfer XML, JSON, or both The last set of constraints that goes into a RESTful Web service design has to do with the format of the data that the application and service exchange in the request/response payload or in the HTTP body. This is where it really pays to keep things simple, human-readable, and connected.

7 Prepared By : Monika Darji REST Web Services Characteristics Client-Server: a pull-based interaction style: consuming components pull representations. Stateless: each request from client to server must contain all the information necessary to understand the request, and cannot take advantage of any stored context on the server. Cache: to improve network efficiency responses must be capable of being labeled as cacheable or non-cacheable. Uniform interface: all resources are accessed with a generic interface (e.g., HTTP GET, POST, PUT, DELETE). Named resources - the system is comprised of resources which are named using a URL. Interconnected resource representations - the representations of the resources are interconnected using URLs, thereby enabling a client to progress from one state to another. Layered components - intermediaries, such as proxy servers, cache servers, gateways, etc, can be inserted between clients and resources to support performance, security, etc.

8 Prepared By : Monika Darji Examples REST can be found in many places on the public Web: The 'blogosphere' — the universe of weblogs — is mostly REST-based, since it involves downloading XML files (in RSS, or Atom format) that contain lists of links to other resources; The Atom Publishing Protocol for publishing to blogs is considered the canonical RESTful protocol; Amazon.com's S3 is their only truly REST offering; OpenStreetMap offers a REST interface

9 Prepared By : Monika Darji RESTful Web Services versus SOAP Web Services REST SOAP Message Format XML XML inside a SOAP Envelope Interface Definition noneWSDL TransportHTTP HTTP, FTP, MIME, JMS, SMTP

10 Prepared By : Monika Darji JAX-WS The Java API for XML Web Services (JAX-WS) is a Java programming language API for creating web services. It is part of the Java EE platform from Sun Microsystems. It is part of the Java Web Services Development Pack. The Reference Implementation of JAX-WS is developed as an open source project and is part of project GlassFish, an open source Java EE application server.

11 Prepared By : Monika Darji Service Oriented Architecture(SOA) Service-oriented architecture (SOA) is an evolution of distributed computing based on the request/reply design paradigm for synchronous and asynchronous applications. An application's business logic or individual functions are modularized and presented as services for consumer/client applications. What's key to these services is their loosely coupled nature; i.e., the service interface is independent of the implementation. Application developers or system integrators can build applications by composing one or more services without knowing the services' underlying implementations. For example, a service can be implemented either in.Net or J2EE, and the application consuming the service can be on a different platform or language.

12 Prepared By : Monika Darji Characteristics of SOA * SOA services have self-describing interfaces in platform- independent XML documents. Web Services Description Language (WSDL) is the standard used to describe the services. * SOA services communicate with messages formally defined via XML Schema (also called XSD). * SOA services are maintained in the enterprise by a registry that acts as a directory listing. Applications can look up the services in the registry and invoke the service. Universal Description, Definition, and Integration (UDDI) is the standard used for service registry. * Each SOA service has a quality of service (QoS) associated with it. Some of the key QoS elements are security requirements, such as authentication and authorization, reliable messaging, and policies regarding who can invoke services.

13 Prepared By : Monika Darji The ROLE OF WSDL in SOA WSDL is the interface definition language (IDL) that defines the interactions among SOA components. It provides a standard language for describing how to communicate with a component. Following figure shows the role of WSDL for SOA..The deployment takes place in Web Services Platform subsystem. The top-level class depicted in that subsystem is ServiceDeployment. Each instance of ServiceDeployment corresponds to a Web service that is deployed on this platform.The ServiceDeployment contains both an operation (taken from the WSDL interface description) and a Java method. A Web service deployment defines a relationship between a WSDL interface description and a Java implementation of that description.

14 Prepared By : Monika Darji

15 The ROLE OF SOAP in SOA The role of SOAP in SOA is to provide a concrete implementation,or binding, for the WSDL interfaces.


Download ppt "Prepared By : Monika Darji Web Services using REST & JAX-WS."

Similar presentations


Ads by Google