Restful Integration with WSO2 ESB
 

Like this? Share it with your network

Share

Restful Integration with WSO2 ESB

on

  • 787 views

 

Statistics

Views

Total Views
787
Views on SlideShare
677
Embed Views
110

Actions

Likes
5
Downloads
55
Comments
0

5 Embeds 110

http://wso2.com 91
http://www.slideee.com 12
https://twitter.com 3
https://www.linkedin.com 2
http://translate.googleusercontent.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Restful Integration with WSO2 ESB Presentation Transcript

  • 1. Chanaka Fernando Technical Lead Ishan Jayawardena Senior Software Engineer May 29 2014 RESTful Integration with WSO2 ESB
  • 2. About the Presenters ๏ Chanaka Fernando - chanakaf@wso2.com Chanaka joined WSO2 in January 2013. He is a Technical Lead in the WSO2 Enterprise Service Bus team. In addition to his product development efforts he has also provided technology consulting on customer engagements, including customer QuickStart programs. Chanaka has also published numerous articles on WSO2 products which are available in the WSO2 library. ๏ Ishan Jayawardena - ishan@wso2.com Ishan is a Senior Software Engineer in the integration technologies team where he mainly focuses on the WSO2 Enterprise Service Bus. In addition to his product development efforts he has also provided technology consulting on customer engagements, including customer QuickStart programs focused on Enterprise Application Integration projects.
  • 3. About WSO2 ๏ Global enterprise, founded in 2005 by acknowledged leaders in XML, web services technologies, standards and open source ๏ Provides only open source platform-as-a- service for private, public and hybrid cloud deployments ๏ All WSO2 products are 100% open source and released under the Apache License Version 2.0. ๏ Is an Active Member of OASIS, Cloud Security Alliance, OSGi Alliance, AMQP Working Group, OpenID Foundation and W3C. ๏ Driven by Innovation ๏ Launched first open source API Management solution in 2012 ๏ Launched App Factory in 2Q 2013 ๏ Launched Enterprise Store and first open source Mobile solution in 4Q 2013
  • 4. What WSO2 delivers
  • 5. Agenda ๏ What is WSO2 Enterprise Service Bus (ESB) ๏ The importance of REST ๏ Configuring REST APIs and resources with WSO2 ESB ๏ Extended JSON support for RESTful integrations ๏ Designing APIs with uri-templates and url-mapping techniques ๏ Use Case : Pizza Shop
  • 6. * WSO2 Enterprise Service Bus ๏ A lightweight, high performance ESB ๏ Comprehensive REST, SOAP, WS-* support ๏ 100% compliant with all EIPs (Enterprise Integration Patterns) ๏ Connectors (Salesforce, Twilio and many more) ๏ SAP, FIX, HL7 - Domain specific solutions ๏ Zero Code/Configuration driven ๏ Extensible and Scalable
  • 7. WSO2 Enterprise Service Bus ๏ Under the hood: Apache Synapse ๏ A lightweight, open source ESB implementation from the ASF :http: //synapse.apache.org ๏ Makes up the mediation engine of WSO2 ESB ๏ Multithreaded and asynchronous message processing core ๏ Based on a number of well known open source projects (eg: Axis2, Http Core)
  • 8. What is REST? ๏ REpresentational State Transfer ๏ An architectural Style – Not a Standard ๏ REST uses HTTP for CRUD (Create/Read/Update/Delete) operations ๏ RESTful applications use HTTP requests to • post data (create and/or update) • read data (e.g., make queries) • Delete data.
  • 9. Trend towards REST ๏ Amazon AWS (Over 90% of the clients use RESTful API) ๏ Google Maps ๏ Yahoo ๏ Ebay ๏ Twitter
  • 10. ESB REST APIs ๏ Similar to a web application hosted on the ESB ๏ Anchored at a specific URL path (context) ๏ Eg: /news ๏ Can be bound to a specific hostname:port ๏ Contains one or more Resources
  • 11. ESB REST APIs ๏ Exposes RESTful APIs ๏ REST → SOAP conversion ๏ SOAP → REST conversion ๏ REST → REST conversion
  • 12. ESB REST APIs ๏ Creating a REST API...
  • 13. ESB REST APIs : Resources ๏ A RESTful resource exposed over HTTP Eg: /news/latest ๏ Similar to a proxy service but focuses on REST ๏ Can be associated with ๏ A set of HTTP verbs ๏ A specific content type ๏ A particular class of clients (user agents)
  • 14. ESB REST APIs : Resources ๏ URL Patterns ๏ Regex match (/news/*) ๏ Extension match (*.jsp) ๏ Exact match (/news/index.jsp) ๏ URI templates ๏ /dictionary/{char}/{word} ๏ HTTP verbs (GET/POST/PUT/DELETE) ๏ A set of HTTP verbs ๏ A specific content type ๏ A particular class of clients (user agents)
  • 15. ESB REST APIs : Resources
  • 16. ESB REST APIs : Resources /people
  • 17. ESB REST APIs : Resources /people GET /staff/*
  • 18. ESB REST APIs : Resources /people GET /staff/* POST /add?name={name}&id={id}
  • 19. ESB REST APIs : Resources
  • 20. HTTPEndpoint <endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint"> <http uri-template="http://localhost:8080/{uri.var. companyname}/restapi/{uri.var.servicename}/menu? category={uri.var.category}" method="GET"> </http> </endpoint> Sample request: http://localhost:8280/pizza? companyname=wso2&servicename=lunch&category=vegetable
  • 21. ๏ Data Formats plays a major role in REST integrations ๏ Easy to transform between JSON and XML ๏ Native JSON support for handling JSON only scenarios like mobile applications ๏ Directly evaluate json message rather than converting to XML Eg: <filter source="json-eval(pizza.name)" regex=" Meat Sizzler"> JSON Support for REST
  • 22. Use Case : Pizza Shop
  • 23. API - /pizzashop Resources ๏ Pizza - /api/menu/pizza* [GET] ๏ Order - /api/order* [POST] ๏ Order - /api/order/{orderId} [POST, GET, DELETE, PUT] ๏ Purchase - /api/purchase/{orderId} [POST] Use Case : Pizza Shop
  • 24. <resource methods="GET" uri-template="/api/menu/pizza*"> <inSequence> ....................... </inSequence> <outSequence> ....................... </outSequence> </resource> sample requests http://127.0.0.1:8280/pizzashop/api/menu/pizza http://127.0.0.1:8280/pizzashop/api/menu/pizza? val=thin&type=crust Use Case : Pizza Shop
  • 25. <resource methods="POST" uri-template="/api/order*"> <inSequence> ..................... </inSequence> <outSequence> ..................... </outSequence> </resource> sample requests http://127.0.0.1:8280/pizzashop/api/order {"order": { "items": [ {"id": 1, "qty": 2}, {"id": 2, "qty": 1} ] }} Use Case : Pizza Shop
  • 26. <resource methods="POST GET DELETE PUT" uri-template="/api/order/{orderId}"> <inSequence> ...................... </inSequence> <outSequence> ...................... </outSequence> </resource> sample requests http://127.0.0.1:8280/pizzashop/api/order/0001 Use Case : Pizza Shop
  • 27. <resource methods="POST" uri-template="/api/purchase/{orderId}"> <inSequence> .............. </inSequence> <outSequence> ................ </outSequence> </resource> sample requests http://127.0.0.1:8280/pizzashop/api/purchase/0001 {“purchaseInformation”: { “amount”: 175.00, “cc”: "1234-5678-9876-5432" } } Use Case : Pizza Shop
  • 28. Complete sample http://wso2.com/library/articles/2013/12/restful-integration-with-wso2-esb/ Use Case : Pizza Shop
  • 29. Questions?
  • 30. * ๏ WSO2 ESB http://wso2.com/products/enterprise-service-bus ๏ WSO2 ESB Documentation https://docs.wso2. org/display/ESB481/WSO2+Enterprise+Service+Bus+Documentation ๏ RESTful Integration with WSO2 ESB http://wso2.com/library/articles/2013/12/restful-integration-with-wso2- esb/ ๏ How to GET a Cup of Coffee the WSO2 Way http://wso2.com/library/articles/2012/09/get-cup-coffee-wso2-way/ 6 Links
  • 31. ** Business Model
  • 32. Contact us !