Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Services XML-RPC, SOAP, REST Advanced Web-based Systems | Misbhauddin.

Similar presentations


Presentation on theme: "Web Services XML-RPC, SOAP, REST Advanced Web-based Systems | Misbhauddin."— Presentation transcript:

1 Web Services XML-RPC, SOAP, REST Advanced Web-based Systems | Misbhauddin

2 PHP Scenario Advanced Web-based Systems | Misbhauddin Web Server HTTP Request HTTP Response Client exec w/environ html PHP Compiler SQL Database SAME AS CGI <?php $con = mysqli_connect($host, $user, $pwd, $db); $query = “SELECT name FROM user”; $result = mysqli_query($con,$query); $name = mysqli_fetch_array($result)[0]; ?> Test PHP Page Welcome Mr. ……. Presentation + Business Logic + Data (SQL) = All messed up

3 RIA Scenario Advanced Web-based Systems | Misbhauddin Web Server XMLHTTP Request XML Response Browser QUERY_STRING XML Data Server-Side Technology SQL Database JavaScript Update (HTML) Presentation & Visualization Business Logic Data & Models

4 Components of Data Exchange Two applications want to share data over the Internet Initiating Action: Things don’t happen without any reason. A triggering mechanism is needed. Automatic: started at a fixed time (chron job, feed exchange) User Initiated: form submission Data Format: Data needs to be stored and transferred in a format understood by both applications. Data Transfer Mechanism: Process to transfer the data over the internet Advanced Web-based Systems | Misbhauddin

5 Data Transfer Mechanism Selecting a proper protocol and data interchange format to pass data between your app is one of the most important decisions to make during the development process Common and widely used protocols XML-RPC SOAP REST All of these protocols transport data over the HTTP protocol XML-RPC & SOAP are XML-based REST works both with JSON or XML Advanced Web-based Systems | Misbhauddin

6 Web Services Web services are web application components Unlike traditional client / server model (web server / web page system) Does not provide user with a GUI Share business logic, data and processes through a programmatic interface across a network The applications interface, not the users Advanced Web-based Systems | Misbhauddin Client / ServerWeb Services

7 Allow different applications from different sources to communicate with each other Are not tied to any one operating system or programming language Do not require the use of browsers or HTML Web services are sometimes called application services Advanced Web-based Systems | Misbhauddin

8 XML-RPC A set of implementations that allow software running on disparate operating systems, running in different environments to make procedure calls over the Internet Remote procedure calling using HTTP as the transport and XML as the encoding Advanced Web-based Systems | Misbhauddin sample.sumAndDifference 5 3

9 Simple Object Access Protocol (SOAP) SOAP relies exclusively on XML to provide messaging services The XML used to make requests and receive responses in SOAP can become extremely complex Technologies in SOAP WSDL - Web Services Description Language UDDI - Universal Description, Discovery and Integration Advanced Web-based Systems | Misbhauddin

10 SOAP Advanced Web-based Systems | Misbhauddin Messaging protocol that allows programs that run on different operating systems Communicate using HTTP & XML Specifies how to encode HTTP Header and XML Data

11 WSDL It is written in XML It is an XML document It is used to describe Web services It is also used to locate Web services Advanced Web-based Systems | Misbhauddin data type definitions........ definition of the data being communicated.... set of operations...... protocol and data format specification....

12 WSDL Advanced Web-based Systems | Misbhauddin glossaryTerms is a function library, "getTerm" is a function with "getTermRequest" as the input parameter, and getTermResponse as the return parameter

13 UDDI Is a directory service where businesses can register and search for Web services Discover the right business from the millions currently online Reaching new customers and increasing access to current customers Solving customer-driven need to remove barriers Describing services and business processes programmatically in a single, open, and secure environment Advanced Web-based Systems | Misbhauddin Saudi Airlines Fly Dubai Ticket Rate Register Travel Agencies Find Airline Interface UDDI

14 SOAP Building Blocks A SOAP message is an ordinary XML document containing the following elements: An Envelope element that identifies the XML document as a SOAP message A Header element that contains header information A Body element that contains call and response information A Fault element containing errors and status information Advanced Web-based Systems | Misbhauddin.........

15 SOAP Envelope Element It is a required element It is the root element of a SOAP message It defines the XML document as a SOAP message Advanced Web-based Systems | Misbhauddin Namespace Defines the Envelope as a SOAP Envelope Same as Encoding Style Defines the data types used in the document Included as a URI

16 SOAP Envelope Element It is a required element It is the root element of a SOAP message It defines the XML document as a SOAP message Advanced Web-based Systems | Misbhauddin Namespace Defines the Envelope as a SOAP Envelope Same as Encoding Style Defines the data types used in the document Included as a URI

17 SOAP Body Element Contains the actual SOAP message Advanced Web-based Systems | Misbhauddin Apples 1.90 Request Response

18 Advanced Web-based Systems | Misbhauddin

19 SOAP Advantages Platform and language independent Simplified communication through proxies and firewalls Work with different transport protocols – HTTP, SMTP …. Disadvantages Slower than other protocols Uses verbose XML Not used for event notifications Firewall latency Different level of support based on the programming language (PHP, JAVA, Python,.Net) Advanced Web-based Systems | Misbhauddin

20 REST Advanced Web-based Systems | Misbhauddin Representation State Transfer Set of architectural principles – data transmitted over HTTP Focus on design rules for stateless service Each resource is represented using a unique URI Representation of the resource is returned With each representation, client can transfer state

21 REST Advanced Web-based Systems | Misbhauddin RESTful web services are completely stateless Good caching infrastructure over the HTTP GET method Well used for restricted profile devices such as mobile and PDA (SOAP has more headers and not very useful) Simpler than SOAP

22 URLS Advanced Web-based Systems | Misbhauddin Identify the things that you want to operate on – meaning RESOURCES A web page is a type of resource /professorsList of all professors at CCSIT /professors/Misbhauddin Identify professor named ‘Misbhauddin’ GET /professors/Misbhauddin HTTP/1.1 Host: kfu.edu.sa/ccsit Resources are best thought of as nouns

23 Actions Advanced Web-based Systems | Misbhauddin Lets say we want to add a new professor Use a specific URL OR …… Two ways /professors/add Use HTTP Verbs GET /professors/Misbhauddin HTTP/1.1 Host: kfu.edu.sa/ccsit Not RESTful

24 HTTP Verbs Advanced Web-based Systems | Misbhauddin HTTP verbs tell the server what to do with the data identified by the URL. GET instructs the server to transmit the data identified by the URL to the client PUT used when you wish to create or update the resource identified by the URL DELETE used when you want to delete the resource identified by the URL of the request POST used when the processing happen on the server

25 Representations Advanced Web-based Systems | Misbhauddin The HTTP client and HTTP server exchange information about resources identified by URLs Typically resource is represented using JSON or XML Example Resource: person (Mohammed) Service: contact information (GET) Representation: Name, address, phone number JSON or XML format

26 REST Constraints Advanced Web-based Systems | Misbhauddin The six constraints are: Uniform Interface Stateless Cacheable Client-Server Layered System Code on Demand (optional)

27 Uniform Interface | REST Advanced Web-based Systems | Misbhauddin Defines the interface between the client and the server Simplifies and decouples the architecture Identification of resources; Manipulation of resources through representations; Self-descriptive messages; Fundamental to RESTful Design HTTP Verbs: (GET, PUT, POST, DELETE) URI (Resource Name) HTTP Response (status, body)

28 Stateless| REST Advanced Web-based Systems | Misbhauddin Server contains no client state Each request contains enough context to process the message Self-descriptive messages; Any session state is kept on the client

29 Client-Server| REST Advanced Web-based Systems | Misbhauddin Assume a disconnected system Separation of Concern Uniform Interface is the link between the two

30 Cacheable| REST Advanced Web-based Systems | Misbhauddin Server responses (representations) are cacheable Implicitly Explicitly Negotiated

31 Layered System| REST Advanced Web-based Systems | Misbhauddin Client cannot assume direct connection to the server Software or hardware intermediaries between the server and the client Improves scalability

32 Code on Demand| REST Advanced Web-based Systems | Misbhauddin Server can temporarily extend the client Transfer logic to client Client executes logic For example JavaScript Applets Optional

33 SOAP vs. REST SOAP Language, platform, and transport independent (REST requires use of HTTP) Works well in distributed enterprise environments (REST assumes direct point-to-point communication) Standardized Provides significant pre-build extensibility in the form of the WS* standards Built-in error handling Automation when used with certain language products REST No expensive tools require to interact with the Web service Smaller learning curve Efficient (SOAP uses XML for all messages, REST can use smaller message formats) Fast (no extensive processing required) Closer to other Web technologies in design philosophy Advanced Web-based Systems | Misbhauddin

34 Recommended Reading Advanced Web-based Systems | Misbhauddin For the REST architecture http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm


Download ppt "Web Services XML-RPC, SOAP, REST Advanced Web-based Systems | Misbhauddin."

Similar presentations


Ads by Google