Web Services and Mobile

17
Web Services

Transcript of Web Services and Mobile

Page 1: Web Services and Mobile

Web Services

Page 2: Web Services and Mobile
Page 3: Web Services and Mobile
Page 4: Web Services and Mobile
Page 5: Web Services and Mobile

Examples:- facebook- sendgrid- firebase- google prediction api- google QPX api- stripe- paypal

Page 6: Web Services and Mobile

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

XMS vs JSON

Page 8: Web Services and Mobile

<?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

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

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
Page 12: Web Services and Mobile
Page 13: Web Services and Mobile

HTTP METHODS

GETHEADPOSTPUTDELETETRACEOPTIONS

Page 14: Web Services and Mobile
Page 15: Web Services and Mobile

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

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

Further reading

- XML-RPC- JSON-RPC- SOAP

- WSDL (web service definition language) + SOAP binding- ESB (Enterprise Service Bus)