Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Services and Application Development using Services API

Similar presentations


Presentation on theme: "Web Services and Application Development using Services API"— Presentation transcript:

1 Web Services and Application Development using Services API
B. Ramamurthy

2 Interface vs Payload Semantics
Typically interaction between a client and a server results in the execution of an activity (or transaction) Activity needs to be specified by the request. Interface semantics: Requested activity is encoded in an operation signature in the server’s “interface”: RPC (remote procedure call) (think about procedure call or function invocation) Semantics of the activity is explicit in the message/call Payload semantics: It (activity) is embedded in a message 2/27/2019

3 Interface Semantics Process1 Process2 getCustomer() retrieveCustomerData() returnResult() Semantics of the activity is explicitly stated in the message/method call 2/27/2019

4 Payload Semantics Process 1 Process 2
Envelop With message Process 1 Process 2 Requested transaction/activity is embedded in the message Details of the activity not explicit; the semantics are embedded in the message 2/27/2019

5 Payload Semantics onMessage() 2/27/2019

6 Payload semantics is generic
String transferMoney (amt: decimal, accTo: String) { …} Vs. String executeService (message: String) --message contains “transferMoney”, amt, acctTo etc. 2/27/2019

7 XML XML is a markup language, developed by W3C (World Wide Web Consortium), mainly to overcome the limitations of HTML. But it took a life of its own and has become a very popular part of distributed systems. We will examine its definition, associated specifications (DTD, XSLT etc.), Java APIs available to process XML, protocols and services based on XML, and the role XML plays in a distributed computing environment. 2/27/2019 CSE507 Introduction 2008

8 First Look at XML It has no predefined tags. It is stricter.
Such as in HTML Domains may specify their own set of standard tags It is stricter. Most html document have errors and the browser have to built to take care of these. On the other hand XML has a strict syntax. There is a notion of validity and A notion of well-formed. 2/27/2019 CSE507 Introduction 2008

9 An Example: Memo See the two documents enclosed: one in html and the other in XML formats. Observe the meaningful tags in XML. Compare it to a class definition: it looks like a class with data definitions and accessors (tags). 2/27/2019 CSE507 Introduction 2008

10 Memo.html vs memo.xml <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO "> <title>memo.html</title> </head> <body> <h3>Hello World</h3> Bina<br> CSE4/587SOA Students <br> Wake up everyone<br> BR<br> <br> </body> </html> <?xml version="1.0" ?>   <!DOCTYPE memo (View Source for full doctype...)> - <memo>   <header>Hello World</header>   <from>bina</from>   <to>CSE4/587 Students</to>   <body>Wake up everyone</body>   <sign>br</sign>   </memo> 2/27/2019 CSE507 Introduction 2008

11 XML to SOAP Simple xml can facilitate sending message to receive information. The message could be operations to be performed on objects. Simple Object Access Protocol (SOAP) 2/27/2019 CSE507 Introduction 2008

12 SOAP Request <soap:Envelope xmlns:soap=" <soap:Body> <getProductDetails xmlns=" <productId>827635</productId> </getProductDetails> </soap:Body> </soap:Envelope> 2/27/2019 CSE507 Introduction 2008

13 SOAP Reply <soap:Envelope xmlns:soap=" <soap:Body> <getProductDetailsResponse xmlns=" <getProductDetailsResult> <productName>Toptimate 3-Piece Set</productName> <productId>827635</productId> <description>3-Piece luggage set. Black Polyester.</description> <price>96.50</price> <inStock>true</inStock> </getProductDetailsResult> </getProductDetailsResponse> </soap:Body> </soap:Envelope> 2/27/2019 CSE507 Introduction 2008

14 SOAPWeb Services (WS)SOA
Read this paper: 2/27/2019 CSE507 Introduction 2008

15 Document-centric Messages
With emergence of self-descriptive data structures such as XML, document-centric has become popular Semantically rich messages where operation name, its parameters, return type are self descriptive. SOAP (Simple Object Access Protocol) over XML is an example Loose coupling of systems (vs. Java RMI like RPC that are tightly coupled) 2/27/2019

16 Tight vs. Loose coupling
Level Tight coupling Loose coupling Physical coupling Direct physical link required Physical intermediary Communication style synchronous asynchronous Type system Strongly typed (interface semantics) Weak type system (payload semantics) Interaction pattern OO-style navigation of complex object trees Data-centric, self-contained messages Control of process logic Central control of process logic Distributed logic components Service discovery and binding Statically bound services Dynamically bound services Platform dependencies Strong OS and programming language dependencies OS- and programming language dependent 2/27/2019

17 Lets focus on Web services
What is a web service? From OO to WS WS and the cloud WS code

18 Web Services and SOA Web Services is a technology that allows for applications to communicate with each other in a standard format. A Web Service exposes an interface that can be accessed through XML messaging. A Web service uses XML based protocol to describe an operation or the data exchange with another web service. Ex: SOAP A group of web services collaborating accomplish the tasks of an application. The architecture of such an application is called Service-Oriented Architecture (SOA). 2/27/2019 CSE507 Introduction 2008

19 Evolution of the service concept
A service is a meaningful activity that a computer program performs on request of another computer program. Technical definition: A service a remotely accessible, self-contained application module. From IBM, Service Component Object/ Class 2/27/2019 BR

20 Class, Component and Service
Class is a core concept is object-oriented architectures. An object is instantiated form a class. Focus on client side, single address space programs. Then came the component/container concept to improve scalability and deployability. Ex: EJBs. Focus on server side business objects and separation of resources from code. Service came into use when publishing, discoverability, on-demand operation among interacting enterprise became necessity. Focus of enterprise level activities, contracts, negotiations, reservations, audits, etc. BR 2/27/2019

21 Object-oriented programming
Encapsulation of data and function in a class, instances of a class is called an object Objects communicate through messages (invoking methods) Class represents a type from which another type can be derived resulting inheritance hierarchy. Problem: level of abstraction and granularity exposed is fine to enable reuse. Data and functions are tightly coupled. The concept of interface Service-orientation assumes that data and functionality are separated. BR 2/27/2019

22 Web Services and the Cloud
Web Service is a technology that allows for applications to communicate with each other in a standard format. A Web Service exposes an interface that can be accessed through XML messaging. A Web service uses XML based protocol to describe an operation or the data exchange with another web service. Ex: SOAP A group of web services collaborating accomplish the tasks of an application. The architecture of such an application is called Service-Oriented Architecture (SOA). Web service is an important enabling technology of cloud computing: software-as-a-service (SaaS), platform-as-a-service(PaaS), infrastructure-as-a-service (IaaS) 2/27/2019

23 WS Interoperability Infrastructure
Service Description WSDL XML Messaging SOAP/ REST Network HTTP Do you see any platform or language dependencies here? 2/27/2019

24 SOAPWeb Services (WS)
Lets look at some WScode: 2/27/2019

25 Building your own application
2/27/2019 Determine your functionality: UML model use case diagram is a very nice tool to use at this stage Determine the source of your internal and external data Examine the data and its utilization in the application Methods for enhancing the application Web data Crawling and screen scraping RSS feeds (Aaron Swartz.. Go read about him) RESTful services Web services

26 Acquiring the DATA 2/27/2019 Example: Get the houses available from Craigslist and post it on Google maps Enabling technologies for acquiring data: Crawler: spiders, start with a URL and visit the links in the URL collecting data, depth of crawling is parameter Screen scrappers: extract information that is contained in html pages. Biological sciences: High throughput sequencers Web services: APIs that facilitate the communication between applications. Organizations make available the relevant information as services REST and SOAP are two underlying pipes for WS

27 Functionality 2/27/2019 Use case diagram is a good tool to discover/define the functionality of your applications Questions to ask: What are the main functions? What kind of data? Structured? Unstructured? Where will be stored? Will it be shared? What are the sources of data? Does it deal with geographic locations (maps)? Does it share content? Does it have search? Any automatic decisions to be made based on rules? What is the security model?

28 REST SOAP is a heavy weight protocol
Representation State Transfer (REST) Ph.D. thesis by Roy Fielding, who was the Was chairman of the Apache Software Foundation (not anymore) REST uses simple HTML operations GET, PUT, POST, DELETE for carrying out web operations/activity It is an architectural style not a protocol REST has become the favored style for web services to communicate REST-based APIs provides by many applications

29 REST simplicity SOAP: <?xml version="1.0"?> <soap:Envelope xmlns:soap=" soap:encodingStyle=" <soap:body pb=" <pb:GetUserDetails> <pb:UserID>12345</pb:UserID> </pb:GetUserDetails> </soap:Body> </soap:Envelope> Vs REST It uses GET, POST etc of HTTP protocol

30 What else is there? Most Google services API are REST based: Google search REST API, Google translate API, Google Big Query API etc. Netflix REST API Facebook announced it is going to promote Graph API as the means of getting data out its services… These APIs are the means by which you create an integrated application that makes use of the services offered by others into your application Bottom line is we need well understood (and standard) mechanism for invoking (web) services, extracting and adding data


Download ppt "Web Services and Application Development using Services API"

Similar presentations


Ads by Google