Presentation is loading. Please wait.

Presentation is loading. Please wait.

Restful Restful Web Services By Loukik Purohit & Rohit Ghatol.

Similar presentations


Presentation on theme: "Restful Restful Web Services By Loukik Purohit & Rohit Ghatol."— Presentation transcript:

1 Restful Restful Web Services By Loukik Purohit & Rohit Ghatol

2 Restful Web Service Messages(xml/json ) Browser Desktop Mobile CricInfo

3 Restful Using Browser User Intervention Cab Booking Plane Booking Hotel Booking Vacation Subsystem

4 Restful Automated Machines interacting with each other Cab Booking Plane Booking Hotel Booking Vacation Subsystem SMS/

5 Restful Rest in terms of Layman HR Accounts Admin

6 Restful Organized structure To get address of user 1, go to : \Organisation\Users\1\address

7 Restful Same analogy applies to Web Request to get all users Request to get user 1 Request to get address of user 1

8 Restful Request-Response GET Request GET /users/1 HTTP/1.1 Host: xyz.com Accept: application/xml GET Response 1 Loukik Pune java 2... …

9 Restful Request-Response POST Request GET /users HTTP/1.1 Host: xyz.com Content Type: application/xml Accept: application/xml Rohit Pune C++ POST Response 3

10 Restful HTTP HTTP Headers Method:PUT Accept:application/xml Content-Type:application/xml HTTP Body Rohit Pune C++

11 Restful Four verbs for every noun GET POST PUT DELETE

12 Restful JSON Can Data be Represented in form of List and a Map?? Heres JSON var myObject = eval('(' + myJSONtext + ')');

13 Restful JSON Parser

14 Restful How JSON looks like var result= { "users":[{ "id":"1", "name":"loukik", "address":"Pune", "skill":"java" }, { "id":"2", "name":"rohit", "address":"Pune", "skill":"C++ } ] } Accessing json in javascript code result.users[0].name=loukik

15 Restful REST

16 Restful Programmable Web Your Source to Web Service APIs

17 Restful programmableweb.com

18 Restful Implement Restful Webservice Write a Servlet Implement doGet, doPost, doDelete Write business logic Create your Messages, that too JSON

19 Restful JAX-RS To rescue Marrying to API Being POJO (Single) is Great! Servlet EJB JAX-RS

20 Restful JAX-RS More info at u.html u.html JSR 311: JAX-RS

21 Restful JAX-RS Flow JAX-RS Servlet ent Business Logic HTTP Response HTTP Request JSON POJO Model

22 Restful Spring REST Based on Spring MVC

23 Restful Spring REST Negotiated view- based rendering HTTP message converters

24 Restful Enunciate Your Web service API Enunciate Your Web service API + Full HTML documentation + Client-side libraries

25 Restful POJO Client Doc JAX-RS SOAP GWT AMF Java C C ObjC.Net Java Json Comm What does Enunciate do for me?

26 Restful Enunciate Enunciate is an engine for dramatically enhancing your Java Web service API. Enunciate is primarily a build-time tool. Develop your Web service API. Attach Enunciate to your build process.

27 Restful Cross Site Scripting maps.google.com twitter.com Ajax Calls Single Origin Policy

28 Restful Imposed by Browser Single Origin Policy ABC.com XYZ.com Ajax Restrictions Iframe JavaScript Accessing iFrames DOM

29 Restful So How to do Mashups? maps.google.com twitter.com PROXYPROXY Use Proxy

30 Restful So How to do Mashups? maps.google.com twitter.com JSONP Call Use JSONP JSONP Call

31 Restful What is JSONP? ABC.com XYZ.com ABC.com XYZ.com AJAX Call Not Allowed By Browser Including Scripts hosted on other domains is allowed Static Script JS

32 Restful What is JSONP? ABC.com XYZ.com ABC.com XYZ.com AJAX Call Not Allowed By Browser users/1?callback=myfun Including Scripts hosted on other domains is allowed Dynamic Script JS

33 Restful JSONP Explained { "id":"1", "name":"loukik", "address":"Pune", "skill":"java } myfunc({ "id":"1", "name":"loukik", "address":"Pune", "skill":"java }); JSONJSONP Single Origin Policy No Such Restriction

34 Restful JSONP Code Example

35 Restful function myfunc(data){ table.update(data); } Name Address Role Rohit Pune Architect Loukik Pune Geek Add NExt 100

36 Restful XSS ScrapBook WebSite attack script Login Hacked!!! Attacker User

37 Restful

38 How to do XSS? Server needs an XSS Vulnerability Say Dev uses div.innerHTML in code function postScrap(){ div.innerHTML = textarea.value; } TextArea DIV Post What if I put an html with some JavaScript here?

39 Restful How to do XSS? Server needs an XSS Vulnerability Say Dev uses div.innerHTML in code function postScrap(){ div.innerHTML = textarea.value; } Look at this cool image

40 Restful XSRF Cross Site Request Forgery. Unauthorized commands are transmitted from a user that the website trusts. Exploits the trust that a site has in a user's browser.

41 Restful XSRF ScrapBook WebSite Hacked!!! Attacker User Login Send Mail with Script Opens Mail

42 Restful How to do XSRF Browser holds your sessions What if I made you visit a page which uses your session to do hack? Is it Possible?

43 Restful Aye Mate! How come I can use Google + and Facebook Like here? Aye Mate! How come I can use Google + and Facebook Like here?


Download ppt "Restful Restful Web Services By Loukik Purohit & Rohit Ghatol."

Similar presentations


Ads by Google