REST in Peace with Web services Eran Chinthaka Samisa Abeysinghe WSO2 Inc.

Slides:



Advertisements
Similar presentations
Building Enterprise applications with Axis2
Advertisements

Pierre-Johan CHARTRE Java EE - JAX-RS - Pierre-Johan CHARTRE
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to XHTML Programming the World Wide Web Fourth edition.
1 Copyright © [2005]. Roger L. Costello, Timothy D. Kehoe. All Rights Reserved. REST (Representational State Transfer) Roger L. Costello Timothy D. Kehoe.
Copyright © 2003 Pearson Education, Inc. Slide 7-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Copyright © 2003 Pearson Education, Inc. Slide 7-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Chapter 1 The Study of Body Function Image PowerPoint
Processes and Operating Systems
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 1 Embedded Computing.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 3 CPUs.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
UNITED NATIONS Shipment Details Report – January 2006.
1 Hyades Command Routing Message flow and data translation.
19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services.
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
Communicating over the Network
Auto-scaling Axis2 Web Services on Amazon EC2 By Afkham Azeez.
REST - Representational State Transfer
Building and using REST information services Rion Dooley.
CIS* Service-Oriented Computing
Server Access The REST of the Story David Cleary
Web Service Testing RESTful Web Services Snejina Lazarova Dimo Mitev
Written by Liron Blecher
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
© Telcordia Technologies 2004 – All Rights Reserved AETG Web Service Tutorial AETG is a service mark of Telcordia Technologies. Telcordia Technologies.
1 The phone in the cloud Utilizing resources hosted anywhere Claes Nilsson.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 31 Slide 1 Service-centric Software Engineering.
Data Structures Using C++
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 The OSI Model and the TCP/IP.
EU market situation for eggs and poultry Management Committee 20 October 2011.
EIS Bridge Tool and Staging Tables September 1, 2009 Instructor: Way Poteat Slide: 1.
Copyright 2007, Information Builders. Slide 1 Introduction to Web Services Efrem Litwin Director, WebFOCUS Integration Products Information Builders.
XML and Databases Exercise Session 3 (courtesy of Ghislain Fourny/ETH)
25 July, 2014 Hailiang Mei, TU/e Computer Science, System Architecture and Networking 1 Hailiang Mei Remote Terminal Management.
IONA Technologies Position Paper Constraints and Capabilities for Web Services
1 RA III - Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Buenos Aires, Argentina, 25 – 27 October 2006 Status of observing programmes in RA.
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
31242/32549 Advanced Internet Programming Advanced Java Programming
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
© 2012 National Heart Foundation of Australia. Slide 2.
1 © 2004, Cisco Systems, Inc. All rights reserved. CCNA 1 v3.1 Module 2 Networking Fundamentals.
Executional Architecture
Implementation Architecture
Macromedia Dreamweaver MX 2004 – Design Professional Dreamweaver GETTING STARTED WITH.
Presentation 7 part 2: SOAP & WSDL.
Analyzing Genes and Genomes
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Chapter 12 Working with Forms Principles of Web Design, 4 th Edition.
Essential Cell Biology
Intracellular Compartments and Transport
PSSA Preparation.
Essential Cell Biology
Energy Generation in Mitochondria and Chlorplasts
Introduction Peter Dolog dolog [at] cs [dot] aau [dot] dk Intelligent Web and Information Systems September 9, 2010.
TCP/IP Protocol Suite 1 Chapter 18 Upon completion you will be able to: Remote Login: Telnet Understand how TELNET works Understand the role of NVT in.
Building RESTful Interfaces
OpenSG Service Definition, Feb 2010 RESTful Service Discussions Shawn Hu.
SOAP Quang Vinh Pham Simon De Baets Université Libre de Bruxelles1.
Presentation transcript:

REST in Peace with Web services Eran Chinthaka Samisa Abeysinghe WSO2 Inc.

Who We Are Eran Chinthaka Member – Apache Software Foundation Lead Developer – Apache Axiom, Axis2, Synapse, Tungsten W3C WS-Addressing working group member Senior Software Engineer- WSO2 Inc. Samisa Abeysinghe Member – Apache Software Foundation Lead Developer Apache Axis2/C and Axis C++ Software Architect – WSO2 Inc.

Agenda What is REST and Web services? SOAP vs. REST How WSDL 2.0 enables REST? How can it be implemented? – Axis2 Architecture Getting your feet wet with 'code'

4 What is REST...? REpresentational State Transfer Representational State Transfer is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state- machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use. - Roy T. Fielding Architectural Style of network systems

5 Why is it called REST ? Web comprised of resources Accessing Representation of the resource is accessed Places client application in a state Client application changes (transfers)

6 REST, a standard? An architectural style Not a standard But uses standards http url xml/html/gif/jpeg, etc – media types text/xml, text/html, etc – MIME types

7 SOAP SOAP is a messaging protocol has three parts Body is for payload Header is for QoS Addressing, Security, RM

8 REST vs. SOAP REST – Fixed interface URI for GET case XML for POST case – Mostly HTTP Transport – Lighter bandwidth – QoS support – based on transport – Suited for lightweight scenarios SOAP – Flexible interface POST with SOAP envelope – Transport agnostic – Comparatively higher bandwidth – Wide array of message level QoS options – WS-* – Suited for heavyweight scenarios

9 REST? Our objectives Support plain old XML interaction with services over POST Support HTTP GET bindings for services Non-objectives: Support all of REST

10 How WSDL 2.0 Enabled the REST + WS Marriage WSDL 2.0 HTTP binding enables services to be used with GET and POST Specify how to take (certain styles of) an XML Schema and formulate a GET/POST request out of it

11 WSDL 2.0 Rules for HTTP Binding binding type should behttp:// Formulating a HTTP message, contents of payload defined in MessageReference or InterfaceFault Schema should adhere to IRI style

12 IRI Style An element style defined on the schema of the payload Rules : The content model of this element is defined using a complex type that contains a sequence from XML Schema. The sequence MUST only contain elements. It MUST NOT contain other structures such as xs:choice. The sequence MUST contain only local element children. These child elements MAY contain the nillable attribute. The localPart of the element's QName MUST be the same as the Interface Operation component's {name}.

13 IRI Style Rules : The complex type that defines the body of the element or its children elements MUST NOT contain any attributes. If the children elements of the sequence are defined using an XML Schema type, they MUST derive from xs:simpleType, and MUST NOT be of the type or derive from xs:QName, xs:NOTATION, xs:hexBinary or xs:base64Binary.

14 Input and Output Serialization Formats Default :

15 Input and Output Serialization Formats

16 Input and Output Serialization Formats Allowed Formats : source :

17 Operation Styles Required source :

18 Implementing in Apache Axis2 Apache Axis2/Java Apache Axis2/C Understand REST implementation --> Understand Axis2 Architecture....

19 Axis2 – Messaging Engine Piped view

20 Axis2 – The Big Picture Applicatio n Trans port Phas e Z Phas e Y Phas e X XML Message Engine Message Receiver Message Context

21 Axis2 – Inside Message Context MessageContext Property Bag someObjectproperty2 Boolean.TRUEproperty1 Execution Chain... Message Pointers to OperationContext, ServiceContext, ConfigurationContext Other fields Handlers

22 Axis2 - Dispatching Finding the correct service and operation a message is destined to. Dispatchers RequestURIBasedDispatcher AddressingBasedDispatcher SOAPActionBasedDispatcher SOAPMessageBodyBasedDispatcher

23 Axis2 – Content Type Handling Builders for different content types StAXOMBuilder StAXSOAPModelBuilder MTOMSOAPBuilder

24 Marrying REST with Axis2 – Receiving REST Requests Axis2 engine needs SOAPEnvelope to process a message. On receiving the message --> dispatch Get schema and check the message, construct SOAPBody in accordance with the schema Create SOAPEnvelope and pass it to the engine

25 Marrying REST with Axis2 – Receiving REST Requests Engine doesn't know about REST, except a flag Works with GET and POST with any content type

26 Marrying REST with Axis2 – Sending REST Requests Client API is the same for SOAP and REST requests, except a flag to notify its REST HTTP method (optional) content type (optional) TransportSender serializes the proper way

27 Getting Your Feet Wet... Sending a SOAP Request... Sending REST Request (minimal config) Options options = new Options(); options.setTo(new EndpointReference(toEpr)); ServiceClient sender = new ServiceClient(); sender.setOptions(options); OMElement result = sender.sendReceive(getPayload()); Options options = new Options(); options.setTo(new EndpointReference(toEpr)); options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE); ServiceClient sender = new ServiceClient(); sender.setOptions(options); OMElement result = sender.sendReceive(getPayload());

28 More Control Sending REST Request (optional configuration) Setting content type Available content types MEDIA_TYPE_X_WWW_FORM - application/x-www- form-urlencoded MEDIA_TYPE_TEXT_XML - text/xml MEDIA_TYPE_MULTIPART_RELATED - multipart/related MEDIA_TYPE_APPLICATION_XML - application/xml options.setProperty(Constants.Configuration.CONTENT_TYPE, contentType);

29 More Control.... Sending REST Request (optional configuration) Setting HTTP Method Available Web Methods HTTP_METHOD_GET HTTP_METHOD_POST (Default) options.setProperty(Constants.Configuration.HTTP_METHOD, webMethod);

30 REST Configuration in Axis2 – Server Side Any service that abides with WSDL 2.0 HTTP Binding is REST enabled.

31 I'm a C fan, Can I also REST ? YES !!!

32 Getting Your Feet Wet (again) with C Sending a SOAP Request... endpoint_ref = axis2_endpoint_ref_create(env, address); options = axis2_options_create(env); AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref); svc_client = axis2_svc_client_create(env, client_home); AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options); ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, get_payload(env));

33 Getting Your Feet Wet (again) with C... Enabling REST at the client side AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_ENABLE_REST, AXIS2_VALUE_TRUE);

34 Getting Your Feet Wet... Sending REST Request... endpoint_ref = axis2_endpoint_ref_create(env, address); options = axis2_options_create(env); AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref); AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_ENABLE_REST, AXIS2_VALUE_TRUE); svc_client = axis2_svc_client_create(env, client_home); AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options); ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, get_payload(env));

35 More Control AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_CONTENT_TYPE, content_type); AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_HTTP_METHOD, web_method);

36 Summary What is REST and Web services ? SOAP vs. REST How WSDL 2.0 enables REST How can it be implemented – Axis2 Architecture Getting your feet wet with code

37 Questions... ? Download presentation from ApacheConEU2006/RESTInPeaceWithWS.ppt

38 Thank You.