Web Services and Mobile
-
Upload
avner-solomon -
Category
Education
-
view
116 -
download
0
Transcript of Web Services and Mobile
![Page 1: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/1.jpg)
Web Services
![Page 2: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/2.jpg)
![Page 3: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/3.jpg)
![Page 4: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/4.jpg)
![Page 5: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/5.jpg)
Examples:- facebook- sendgrid- firebase- google prediction api- google QPX api- stripe- paypal
![Page 6: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/6.jpg)
Web Services Protocols
● BEEP - Blocks Extensible Exchange Protocol
● E-Business XML
● Hessian
● JSON-RPC
● JSON-WSP
● REST - Representational State Transfer
● SOAP - outgrowth of XML-RPC, originally an acronym for Simple Object Access Protocol
● Universal Description, Discovery, and Integration (UDDI)
● Web Processing Service (WPS)
● WSFL - Web Services Flow Language (superseded by BPEL)
● WSCL - Web Services Conversation Language
● XINS Standard Calling Convention - HTTP parameters in (GET/POST/HEAD), POX out
● XLANG - XLANG-Specification (superseded by BPEL)
● XML-RPC - XML Remote Procedure Call
![Page 7: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/7.jpg)
XMS vs JSON
![Page 8: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/8.jpg)
<?xml version="1.0" encoding="UTF-8"?><bookstore> <book category="CHILDREN"> <title>Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="WEB"> <title>Learning XML</title> <author>Erik T. Ray</author> <year>2003</year> <price>39.95</price> </book></bookstore>
[{
“title”:”Harry Potter”,“author”:”J K. Rowling”,“category”:”CHILDREN”,“year”:2005,“price”:29.99
},{
“title”:”Learning XML”,“author”:”Erik T. Ray”,“category”:”WEB”,“year”:2003,“price”:39.95
}]
![Page 9: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/9.jpg)
XMLpros- extendable- offers support for validation- sometimes easier to understand by a human reader- supported by more web servicescons- huge overhead
JSONpros- easier to implement parsers- faster parser- smaller data- works hand in hand with AJAX and JavaScriptcons- limited data types- can’t enforce rules between interfaces of services- supported mostly by services that are over HTTP
![Page 10: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/10.jpg)
var string = JSON.stringify(object);
var object = JSON.parse(string);
object.toJSON - changes the normal transformation
Example{ "age" : 2 , “name”:”John” }
![Page 11: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/11.jpg)
![Page 12: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/12.jpg)
![Page 13: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/13.jpg)
HTTP METHODS
GETHEADPOSTPUTDELETETRACEOPTIONS
![Page 14: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/14.jpg)
![Page 15: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/15.jpg)
jQuery AJAX
$.ajax({ method: "PUT", url: "some.php", data: { name: "John", location: "Boston" }}) .done( function( msg ) { alert( "Data Saved: " + msg ); } );
![Page 16: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/16.jpg)
jQuery AJAX
$.get("URL")
.done(function(data){
//code on success
})
.fail(function(){
//code on fail
})
.always(function(){
// code called at every end of ajax request for both success and failiure
});
$.post("URL",data)
.done(function(respose){
//code on success
})
.fail(function(){
//code on fail
})
.always(function(){
// code called at every end of ajax request for both success and failiure
});
![Page 17: Web Services and Mobile](https://reader036.fdocuments.in/reader036/viewer/2022071909/55cde534bb61eb953b8b4669/html5/thumbnails/17.jpg)
Further reading
- XML-RPC- JSON-RPC- SOAP
- WSDL (web service definition language) + SOAP binding- ESB (Enterprise Service Bus)