Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Service Programming and Cloud Computing 1. Bigger view of programming What we learnt are mostly small, standalone programming tasks In real world.

Similar presentations


Presentation on theme: "Web Service Programming and Cloud Computing 1. Bigger view of programming What we learnt are mostly small, standalone programming tasks In real world."— Presentation transcript:

1 Web Service Programming and Cloud Computing 1

2 Bigger view of programming What we learnt are mostly small, standalone programming tasks In real world an application involves several tiers and languages –RPC –Client/server architecture –Browser, http server –Browser, http server, DB –Browser, http server, application server, DB –… … Languages involved –Client side: Html, javascript, xml, css, xslt; –Server side: php, java, python, map/reduce, J2EE, sql, … 2

3 3 Web Service

4 4 Service Oriented Architecture Discovery agency ProviderRequester interact find publish

5 5 Registry A concrete SOA WSDL Web Service Provider SOAP Service Consumer Points to description publish Describes Service Finds Service Communicates with XML Messages

6 6 Web Service definition “encapsulated, loosely coupled, contracted software objects offered via standard protocols” --ZapThink Research –Encapsulated –Web Service implementation is invisible to entities outside the service –Exposes an interface but hides details –Loosely Coupled –Service and consumer software can be redesigned independently

7 7 History of Interface Definition Languages (IDLs) IDL has a long history in distributed computing –DCE (Distributed Computing Environment) –CORBA IDL, OMG (Object Management Group) –COM IDL, Microsoft –WSDL Traditional IDLs –Specifying what to call: the operation names, their signatures, exceptions. This is the job of IDL. –Agreeing on how to make an invocation: the mechanism of naming, activation, data encoding. This is what distributed standards such as CORBA or COM do. WSDL needs to specify the both: the operation provided by the service, and the mechanism to access the service.

8 8 Web Service Description Language WSDL defines –What the service is: the operations the service provides, including the signature of the operation –- what –Access specification: details of the data format and protocol necessary to access the service’s operation–- how –Location of the service: details of the network address, such as a URL –- where

9 9 WSDL functionality view OperationPort Type MessageBinding PortService Supports Input & Output Provides How to encode Formats & Protocols How to invoke Implements Interface Endpoints –What –how –where Legend: In WSDL 2.0, portType is changed to interface.

10 10 WSDL document structure view WSDL specification abstract part types messages operations port types concrete part bindings services and ports

11 11 <definitions name="Procurement" targetNamespace="http://example.com/procurement/definitions" xmlns:tns="http://example.com/procurement/definitions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" > <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> port and service binding operation and port type messages abstract part concrete part

12 12 <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:xmethods-BNPriceCheck"/> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:xmethods-BNPriceCheck"/> Returns price of a book at BN.com given an ISBN number

13 13 Visual representation

14 14 WSDL structure—interconnection view WSDL document Types (type information for the document, e.g., XML Schema) Message 1Message 4Message 3Message 2 Operation 1Operation 3Operation 2 Message 5 Interface (abstract service) binding 1 endpoint 1 binding 2 endpoint 2 binding 3 endpoint 3 binding 4 endpoint 4 Service (the interface in all its available implementations) Abstract description of the service Concrete description of the service By Gustavo Alonso and Cesare Pautasso

15 15 A WSDL example <definitions name="PriceCheck" targetNamespace="http://www.skatestown.com/services/PriceCheck" xmlns:pc="http://www.skatestown.com/services/PriceCheck" xmlns:avail="http://www.skatestown.com/ns/availability" xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/"> … This example is from Steve Graham et al: Building Web Services with Java

16 16 PortType defines the interface of web service. Just as Java Interface declaration; –Will change the name to in WSDL 2.0. It consists of a sequence of operation declarations. WSDL can have zero or more s. Typically just one. It has a name attribute, must be unique. –The binding will refer the portType by its name

17 17 Operation Operation defines a method signature; –Name, input, output, and fault Input and output elements are associated with messages; Different combinations of input/output define different operations types.

18 18 Operation Types The request-response type is the most common operation type, but WSDL defines four types: –Request-response: The operation can receive a request and will return a response –One-way: The operation can receive a message but will not return a response. –Notification:The operation can send a message but will not wait for a response –Solicit-response:The operation can send a request and will wait for a response Different types are decided by the order/occurrences of input and output.

19 19 Messages Describe the abstract form of input, output, or fault. A WSDL file can have zero or more messages. Each message has a name, which is unique within the document. Each message has a collection of elements.

20 20 Part A element can be compared to a parameter in a method. A part element has two properties: one is name, the other is its kind. Kind can be a type or an element –Element refers to an element defined in XML Schema –Type refers to a simpleType or a complexType in XSD In corresponding sku definition is:

21 21 Types in WSDL <xsd:element name="StockAvailability" type="avail:availabilityType" /> The default type system is XML Schema; –Theoretically you can use any type system, such as Java types. To be used in element; We can also import XML Schemas

22 22 SOAP request message <soapenv:Envelope xmlns:soapenv=“http://schema.xmlsoap.org/soap/evelope/” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”> 123 Relevant part of the WSDL file: Envelope Body Message Payload Header #1 Header #0

23 23 SOAP response message <soapenv:Envelope xmlns:soapenv= … xmlns:xsd=… xmlns:xsi=… > 123 100.00 12 Relevant part of the WSDL file: <xsd:complexType name="availabilityType">

24 24 Binding Name of the binding should be unique; Link to the portType is achieved by the portType name –This explains why portType name should be unique. Typically, there is only one element; Defines: –Invocation style: rpc vs. document –SOAPAction –Input message appearance: literal or encoded –Output message appearance

25 25 Service Contains a set of elements; combines the interface binding with a network address specified by a URI; A web service can be available in different web addresses;

26 26 Tools WSDL parser: WSDL4J Apache Axis –Invoking SOAP web service; –Translate WSDL to Java, and vice versa; –Mapping Java into XML Schema, and vice versa; –Host web service; –API for manipulating SOAP;

27 27 Mapping between Java and WSDL in JAX-RPC A simple example public interface FooBar extends java.rmi.Remote{ public float foo(java.lang.String para1) throws java.rmi.RemoteException; }

28 28 Multiple input parameters public interface FooBar extends java.rmi.Remote{ public float foo(String param1, int param2, boolean param3) throws java.rmi.RemoteException; }

29 29 Multiple output parameters public interface FooBar extends java.rmi.Remote{ public void foo(String param1, javax.xml.rpc.holders.IntHolder param2, javax.xml.rpc.holders.BooleanHolder param3, javax.xml.rpc.holders.FloatHolder param4, ) throws java.rmi.RemoteException; }

30 30 Mapping XML Schema to Java public class Address { private String street; private String city; public String getCity(){return city; } public void setCity(String c){city=c; } … } Class has to have correct getters and setters; In axis, you can use WSDL2Java and Java2WSDL to do the mapping.

31 60-440 31 03-60-440 Mashups

32 60-440 32 03-60-440 Mashups

33 60-440 33 Mashups From Wikipedia –Mashup (music), a musical genre of songs that consist entirely of parts of other songs –Mashup (video), a video that is edited from more than one source to appear as one –Mashup (web application hybrid), a web application that combines data and/or functionality from more than one source Combine data from multiple sources. –Mostly the data sources lay outside of the organizational boundaries Create a new and distinct web service that was not originally provided by either source. Content is typically sourced via a web API or a RSS Feed Mashup

34 60-440 34 Mashup example The ChicagoCrime.org Web site –A mapping mashup –One of the first popular mashups –Mashes crime data from the Chicago Police Department’s online database with cartography from Google Maps –The concept and the presentation are simple and the composition of crime and map data is visually powerful The following slides are borrowed from Umut Orhan Mashup

35 60-440 35 Why mashup Everybody needs customized applications, tailored to his/her own requirements, taste, style. DIY in software/web application construction –There are many building blocks (web APIs, web services) –there are also some tools to assemble the building blocks It is like end-user programming

36 60-440 36 Mashup flavours Presentation mashups: e.g. Google Maps apps, with emphasis on presentation This is the shallowest form of mashup in the sense that underlying data and functionality don’t meet. Information and layout is retrieved and either remix or just placed next to each other. Many of the Ajax desktops today fall into this category and so do portals and other presentation mashup techniques. Data mashups: merging data from different sources Business mashup: combination of above. combines data integration, presentation plus addition functionality, such as collaboration features Mashup

37 60-440 37 Map mashups Locational information presented graphically using maps in a specified context Google Maps API opened the floodgates –mash all sort of data from nuclear disasters to Boston’s CowParade cows onto maps Other APIs –Microsoft (Virtual Earth) –Yahoo (Yahoo Maps) –AOL (MapQuest) Mashup Genres

38 60-440 38 Photo and Video Photo/video hosting and social networking sites resulted interesting mashups. –Flickr –YouTube –Facebook Metadata associated with the hosted images and videos –Who took the picture –What it is a picture of –Where and when it was taken –So on… Mashup Genres

39 60-440 39 Search and shopping Exist long before the term Mashup was coined –Combinations of B2B technologies or screen-scraping to aggregate comparative price data –eBay –Amazon –… Mashup Genres

40 60-440 40 News News sources such as BBC and Reuters have used syndication technologies like RSS and Atom since 2002. Personalized newspaper by Syndication feed mashups Doggdot.us, combines feeds from the techie-oriented news sources Digg.com, Slashdot.org and Del.icio.us Mashup Genres

41 60-440 41 Content provider Web Protocols –REST Services –SOAP Web Services –RSS/Atom Screen Scraping –Scraping is the process of using software tools to parse and analyze content that was originally written for human consumption in order to extract semantic data structures representative of that information that can be used and manipulated programmatically.

42 60-440 42 Mashup platforms IGoogle Yahoo Pipes Openkapow IBM QedWiki Microsoft popfly Google Mashup Editor (migrated to Google App Engine) … … Mashup platforms

43 60-440 43 Yahoo! pipes Visual development environment for generating data-oriented mashups Development is based on: –Dragging gadgets (pipes) from a toolbox and dropping them in work zone –Specifying data input –Interconnecting gadgets through pipes –Specifying data output format Mashup platforms

44 60-440 44 Ajax AJAX (Asynchronous JavaScript and XML)JavaScriptXML Ajax and AJAX Characteristic: increased responsiveness and interactiveness of web pages –exchanging small amounts of data with the server –entire web page does not have to be reloaded each time the user performs an action. Not a technology itself, but a term refer to the use of a group of technologies The "core" and defining element of Ajax is the XMLHttpRequest object, which gives browsers the ability to make dynamic and asynchronous data requests without having to reload a page, eliminating the need for page refreshes. Web 2.0 The following slides are from Jimmy Lin The iSchool University of Maryland

45 60-440 45 “Old-School” Web Applications server-side systems backend database browser Interface Web server HTTP request HTTP response 1 user does something 2 browser sends request to server 3 server generates Web page as a response to the request 4 data is returned in response to the request 5 browser replaces view with data sent from server

46 60-440 46 Characteristics User-driven: Things only happen when the user does something (e.g., clicks on a link or button) Views defined by URLs: You can bookmark something and come back to it; use the forward/backward button Simple user interaction model: Not that many things you can do in browser Synchronous Interaction: System responses are synchronized with user-driven events

47 60-440 47 Synchronous Interactions browser server-side Time user activity server processing Request  Response  browser server-side systems HTTP request HTTP response 1 2 4 5 3 1 2 3 4 5

48 60-440 48 LAMPLAMP Linux Apache MySQL PHP/Python/Perl So what do you run on the server side?

49 60-440 49 From “Old-School” to Ajax browser Interface request response Ajax intermediates between the interface and the server. server-side systems backend database Web server data management Ajax “engine” interaction management

50 60-440 50 Inside the Browser browser HTML / CSS data HTML / CSS data other data (e.g. images) InterfaceRendering Engine HTTP request HTTP response

51 60-440 51 Enter JavaScript browser HTML / CSS data HTML / CSS data other data (e.g. images) InterfaceRendering Engine HTTP request HTTP response JavaScript Engine JavaScript code

52 60-440 52 Enter Ajax browser HTML / CSS data HTML / CSS data other data (e.g. images) InterfaceRendering Engine HTTP request HTTP response JavaScript Engine XML data JavaScript code XMLHttpRequest HTTP request

53 60-440 53 From Synchronous Interactions… browser server-side Time user activity server processing Request  Response 

54 60-440 54 To asynchronous Interactions browser server-side Time user activity server processing Request  Response  client-side processing

55 60-440 55 Components of an Ajax Interaction 1.A client event occurs (captured by JavaScript event handlers) 2.An XMLHttpRequest object is created and configured 3.An asynchronous request is made to the server via the XMLHttpRequest object 4.Server processes request and returns data, executing a callback in the XMLHttpRequest object 5.The HTML DOM is updated based on response data

56 60-440 56 DOM Document Object Model: platform- and language-independent way to represent XML –Adopts a tree-based representation –W3C standard, supported by modern browsers JavaScript uses DOM to manipulate content –To process user events –To process server responses (via XMLHttpRequest)

57 60-440 57 Ajax: Things to watch out for! Hype Application development/maintenance cost –Brower incompatibilities –Many different approaches and tools –For many things, lack of agreed-on best practices Behavior is not ‘Web-like’ –Standard things often don’t work correctly (e.g., browser ‘back’ button, bookmarks) –Usability issues for users with disabilities Security issues

58 Cloud computing 58

59 What is cloud computing Cloud –Datacenter hardware and software that the vendors use to offer the computing resources and services Cloud computing –Refer to both the cloud and the services provided Why called cloud computing –the computing happens out there "in the clouds” –wikipedia: "the term derives from the fact that most technology diagrams depict the Internet or IP availability by using a drawing of a cloud." 59

60 Definition of cloud computing A large-scale distributed computing paradigm Driven by economies of scale Provider has a pool of abstracted, virtualized, dynamically- scalable resources –Computing power, storage, platforms, and services Delivered to customers on demand 5 Characteristics (NIST 2009) –On demand self-service –Broad network access –Resource pooling –Rapid elasticity –Measured service 60

61 Timeline of cloud computing 61 From Dr. Javier Soriano

62 Evolution of cloud computing 62

63 Economic reason for cloud computing 63

64 Challenge of cloud computing: Elasticity Animoto.com: –Started with 50 servers on Amazon EC2 –Growth of 25,000 users/hour –Needed to scale to 3,500 servers in 2 days (RightScale@SantaBarbara) 64

65 RPC In the early 1980’s, software was not yet “distributed”, only “copied around” Programmers wanted to install software once on a server, and then call it remotely over a network from many clients “Remote Procedure Call” (RPC) Several major efforts were made to do RPC over the next 25 years All suffered from at least one of the common “fallacies of distributed computing”: –The network is secure –The network is homogeneous –The network is fast enough HTTP partially fulfilled the need in the early 1990’s –Programmers could make HTTP GET requests in those days, but the language support for it was not great until recent years 65

66 Early days of distributed computing 1980’s: –RPC using C/C++ –EDI (Electronic Data Interchange) –Microsoft DCOM 1990’s: –CORBA (for Unix/Linux only) –HTTP (so-called REST web services) Still no way to distribute an application across multiple computers that was: –standards-based –platform-independent 66

67 SOA (Service Oriented Architecture) They would be standards-based, platform-independent, and immune to firewalls –some kind of XML would be the wire format Each service’s contract would be expressed in a formal manner and registered in a catalog –programming languages could “parse” this contract and utilize it at runtime, like an interface in Java –there would be a “factory” call that returned a reference to the currently preferred implementation of a given service contract –software architects would “compose” designs by shopping among available services Network and machine speed and capacity would increase to make the overhead of XML tolerable –massive software reuse would be achieved 67

68 Another form of out sourcing Differences –Scalability –‘pay per use’, flexible arrangement 68

69 Three basic service models Users: use software on thin clients. –Do not need to download and install the software –E.g. google doc, online tax Developers: use some languages, APIs, servers to develop and deploy an application –Do not need a server to host the application Network architect 69

70 Basic service models 70

71 Service Model Architectures 71

72 Cloud Infrastructure as a Service (IaaS) Also known as Hardware as a Service (HaaS). Service provider owns the equipment; responsible for housing, running and maintaining it. Client typically pays on a per-use basis, creates virtual machines (VMs) on demand –They have full access to these VMs Strengths: –Can control and configure environment –Familiar technologies –Limited code lock-in Weaknesses: –Must control and configure environment –Requires administrative skills to use e.g. Amazon Web Service, Rackspace, GoGrid 72

73 73

74 PaaS Platform provides hardware architecture and software framework (including application frameworks) Developers provide an application, which the platform runs –They don’t work directly with VMs Strengths: –Provides higher-level services than IaaS –Requires essentially no administrative skills Weaknesses: –Allows less control of the environment –Can be harder to move existing software e.g. Google App Engine, which supports Java and Python, and Engine Yard, which supports Ruby on Rails. 74

75 SaaS Very common in the IT community Software companies host their software themselves and then upgrade to maintain users e.g. Salesforce.com –online CRM, Live.com, Zoho, Google Docs, Microsoft Web Apps 2010 75

76 76 Three Features of Mature SaaS Applications Scalable –Handle growing amounts of work in a graceful manner Multi-tenancy –One application instance may be serving hundreds of companies –Opposite of multi-instance where each customer is provisioned their own server running one instance Metadata driven configurability –Instead of customizing the application for a customer (requiring code changes), one allows the user to configure the application through metadata 76

77 77 SaaS Maturity Levels Level 1: Ad-Hoc/Custom Level 2: Configurable Level 3: Configurable, Multi- Tenant-Efficient Level 4: Scalable, Configurable, Multi-Tenant- Efficient 77 Source: Microsoft MSDN Architecture Center

78 SaaS PaaS IaaS AmazonGoogleMicrosoftSalesforce Service Delivery Model Examples 78

79 Cloud Deployment Models Private cloud –enterprise owned or leased Community cloud –shared infrastructure for specific community Public cloud –Sold to the public, mega-scale infrastructure Hybrid cloud –composition of two or more clouds 79

80 Case studies 80

81 Google Cloud Started with Google Apps Platform as Service later on Replace office software –Gmail –Google Docs (word processing and spreadsheets) –Google video for business –Google sites (intranet sites and wikis) Google Cloud Connect 500,000+ organizations use Google Apps GE moved 400,000 desktops from Microsoft Office to Google Apps 81

82 Google App Engine Exposes the Google Infrastructure to the outside world –BigTable –Python Language runtime –Access to some google api’s (authentication, image, manipulation) APIs –Python Runtime, The Python environment in which your app runs; CGI, –sandbox features, application caching, logging –Datastore API, BigTable – Google’s Database –Images API, the image data manipulation service –Mail API, sending email from your app –Memcache API, the distributed memory cache –URL Fetch API, accessing other Internet hosts from your app –Users API, integrating your app with Google Accounts –You should expect to see more API’s exposed. More specifically the Google API’s for Docs, GWT, etc 82

83 Amazon Cloud Amazon cloud components –Elastic Compute Cloud (EC2) –Simple Storage Service (S3) –SimpleDB 83

84 84

85 Amazon Cloud Users: New York Times and Nasdaq Both companies used Amazon’s cloud offering New York Times –Used EC2 and S3 to convert 15 million scanned news articles to PDF (4TB data) –Took 100 Linux computers 24 hours (would have taken months on NYT computers –“It was cheap experimentation, and the learning curve isn't steep.” – Derrick Gottfrid, Nasdaq Nasdaq –Uses S3 to deliver historic stock and fund information –Millions of files showing price changes of entities over 10 minute segments –“The expenses of keeping all that data online [in Nasdaq servers] was too high.” – Claude Courbois, Nasdaq VP –Created lightweight Adobe AIR application to let users view data 85

86 Salesforce Cloud Started with information management service that could replace traditional business software technology Pioneered software-as-a-service market (esp. CRM tools) 5,000+ Public Sector and Nonprofit Customers use Salesforce Cloud Computing Solutions Moving beyond SaaS into the platform-as-a-service market 86

87 Salesforce.com in Government President Obama’s Citizen’s Briefing Book –134,077 Registered Users –1.4 M Votes –52,015 Ideas –Peak traffic of 149 hits per second US Census Bureau Uses Salesforce.com Cloud Application –Project implemented in under 12 weeks –2,500+ partnership agents use Salesforce.com for 2010 decennial census –Allows projects to scale from 200 to 2,000 users overnight to meet peak periods with no capital expenditure 87

88 88 Facebook’s Use of Open Source and Commodity Hardware 400 million users + 250,000 new users per day 100,000 transactions per second, 10,000+ servers Built on open source software –Web and App tier: Apache, PHP, AJAX –Middleware tier:Memcached (Open source caching) –Data tier:MySQL (Open source DB) Thousands of DB instances store data in distributed fashion (avoids collisions of many users accessing the same DB)

89 Drawbacks Excessive dependence on the Internet Subject to ISP and Cloud Service Providers’ disclosure policy Inappropriate for sensitive, classified data Data replication, coherency, integrity loss 89


Download ppt "Web Service Programming and Cloud Computing 1. Bigger view of programming What we learnt are mostly small, standalone programming tasks In real world."

Similar presentations


Ads by Google