1 / 28

Web Services a gentle intro

Web Services a gentle intro. Martin Q. Zhao CSC colloquium November 8, 2013. Outline . Components and Services The Evolution of Distributed Computing The Concept of Web Services WS-related Technologies Create, Publish, and Consume a WS. What is a Service?.

tavia
Download Presentation

Web Services a gentle intro

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Servicesa gentle intro Martin Q. Zhao CSC colloquium November 8, 2013

  2. Outline Components and Services The Evolution of Distributed Computing The Concept of Web Services WS-related Technologies Create, Publish, and Consume a WS

  3. What is a Service? • Service in everyday context: • work done for somebody else (Bing dictionary) • the work performed by one that serves (Webster) • What are the advantages of a service? • Expertise • Efficiency and cost effectiveness • Reusability (everyone can request the same service) • Loosely coupling (no need to worry about how it’s done)

  4. Service in Software • Service in software context: • task performed by one app (server) for another app (client) • Software component: • Provides a service that confirms to a set of required operations • E.g., DBMS provides CRUD operations

  5. Component-Based Design Web Server Application Server Also known as distributed architecture Break up application logic and distribute cohesive chunks of functions (services) into loosely coupled reusable modules (components) Make building complexsystems easier

  6. Data and Operations • Fundamental tasks of software applications = automating information transformation processes • Organize information: define and store • Perform transformation: manipulating data based on application logic • Applications can share data and operations • Students/professors/deans/registrars share course data • Various E-Business sites use FedEx delivery service (including operations like pricing, tracking, etc.)

  7. Sharing Data: Asynch. vs. Synch. Appl. A Appl. B Appl. A Appl. B write read Shared Memory File Appl. B Appl. A Appl. C Appl. A read Appl. B Appl. D write read read Database

  8. Service-Based Integration • Middleware independent data format [XML] • Refined concept of registry [UDDI] • Refined interface definition [WSDL] • SOAP WebServices Messaging • Separate n/w & marshaling • Scalable connectivity • Guaranteed delivery Object Request Brokers (ORBs) • Language independent interface [IDL] • Initial concept of registry • Separate n/w & marshaling Aka distributed objects Remote Procedure Call (RPC) • Functionality sharing • Interface description • Platform independent Aka Client/Server Sockets • Connectivity • Real-time data sharing • Data sharing only • Limited data type • Tightly coupled

  9. What is a Web Service? [...] a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XMLserialization in conjunction with other Web-related standards. A WS is a SW service accessible on the Web. A Web service is a software function provided at a network address over the web or the cloud, and it is "always on" (as in the concept of utility computing) . The W3C defines a "Web service" as:

  10. How Does It Work? • Web services are abound with a number of standards • XML: machine-independent communication language • HTTP-based: supported by all operating systems • WSDL: XML-based interface description language • SOAP(simple object access protocol): specification for exchanging structured information • UDDI(Universal Description, Discovery and Integration ): common means for service lookup

  11. XML • Extensible Markup Language • W3C standard since late 90’s : fundamental to WS • Use tags to markup contents (in Unicode character set) and relationships among them • Use DTD (document type definition) and later XSD (XML Schema Definition) to define schema and validate docs • Advantages for WS • Independent from H/W and S/W platforms • Support any structure yet maintain it in transit

  12. A Sample XML Doc

  13. WSDL • Web Services Description Language (since 2001) • Programming language and middleware independent • Free to choose a communication protocol • Free to choose any convenient message format (SOAP, RESTful + XML/JSON, XML RPC, etc) • A wide range of service operations to choose from (synch, asynch, RESTful, SOAP) • A service end point (N/W address) can be specified

  14. Typical Message Formats <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Header> </soap:Header> <soap:Body> ... message data ... <soap:Fault> </soap:Fault> </soap:Body> </soap:Envelope> SOAP <profile> <firstName>Jakob</firstName> <lastName>Jenkov</lastName> <address> <street>The Road 123</street> <zip>12345</zip> <city>Copenhagen</city> </address> </profile> { firstName : "Jakob", lastName : "Jenkov", address : { street : "The Road 123", zip : "12345", city : "Copenhagen" } } XML JSON

  15. UDDI • Universal Description, Discovery and Integration • Platform-independent, XML-based registry • Three components • White page: address, name • Yellow page: categories • Green pages: tech info • The process • Service provide publishes WSDL • Service consumer looks up WS • Service consumer consumes WS

  16. WS vs. Distributed Objects • CORBA – common object request broker architecture Service Consumer [ object, uuid(a03d1420-b1ec-11d0-8c3a-00c04fc31d2f), ] interface IFace1 : IUnknown { HRESULT MethodA([in] short Bread, [out] BKFST * pBToast); HRESULT MethodB([in, out] BKFST * pBPoptart); };

  17. Commonly Used Web Services • Get five days weather report for a given zip code (USA) • Get FedEx shipping rate • Get the Barnes & Noble price by ISBN • Get name and address data associated to any telephone number • Call any phone number and speaks text or sound file to the person. • Instantly determines the distance between two U.S. ZIP codes. • Get historical end of day data for U.S. stock options

  18. A B2C Case Study – Call a Cab • The E-Business 1.0 experience • iQTaxi by qSent.com in 2001 • RPC-style WS provided for 3rd party integration

  19. A B2C Case Study –Call a Cab (cont’d) • Uber: An E-Business 2.0 experience • Made to the news in 2011 • Mash-up w/ GoogleMap for real-time interactions

  20. How to Create a WS – in Java? • Resources the you will need • Java Enterprise Edition (JEE 7) • A Java Application Server (such as GlassFish 4) • A Web Server (such as Apache 2.4) • Ideally an IDE for JEE (such as NetBeans 7.4) • Design decisions to make before coding • Operations to provide  get name & say hello • Message format to use  SOAP

  21. Five Steps to Completion • Creating a Web Application project • An umbrella for a web, source, and WS folders • Adding a Web Service class w/ a desired name • Defining the Web Service • Specify service and method names, as well as parameters • Publishing and testing the Web Service • Creating a client app to consume the WS

  22. Five Steps … - WS Project Folder & Code

  23. Five Steps … - Deploy the WS w/ GlassFish

  24. Five Steps … - Testing WS on localhost http://localhost:8080/HelloWS/

  25. Five Steps … – generated WSDL & schema

  26. Five Steps … – client app code & GUI

  27. A Hello World Web Service Service Consumer

More Related