1 / 37

Build Your Mashup with Web Services

Build Your Mashup with Web Services. Ning Yan, IBM.COM nyan@us.ibm.com. Agenda. Introduction of Mashups Introduction of JSON Introduction of XQuery Build Your own Mashups Pre knowledge on using Eclipse Pre knowledge on web applications Java, SQL Html and JavaScript.

dalmar
Download Presentation

Build Your Mashup with Web Services

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. Build Your Mashup with Web Services Ning Yan, IBM.COM nyan@us.ibm.com

  2. Agenda • Introduction of Mashups • Introduction of JSON • Introduction of XQuery • Build Your own Mashups • Pre knowledge on using Eclipse • Pre knowledge on web applications • Java, SQL • Html and JavaScript IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  3. Introduction of Mashups • What is Mashups • The relationship with Web Services • SOA • REST Services • Data format and Web 2.0 requirement • Security and Web 2.0 requirement IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  4. Introduction of Mashups IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  5. Introduction of Mashups (ibm.com ?! ) IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  6. What is Mashups? (1) A mashup is a website or application that combines content from more than one source into an integrated experience. (From wikipedia) - content - data - glue to integrate Other similar names …??? … the name reflects … IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  7. What is Mashups? (2) • Content • Private • semi-private (group shared) • public • Data (format) • Plain text data • Structured text (xml, csv, json, rss, html … … etc.) • Data (Storage) • File • Database • Network (urls) IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  8. What is Mashups? (3) • Tools (In existing mashup technologies) • API is a kind of higher level program interface, the major sites provide this. (http://www.programmableweb.com/apis) • Widgets and Gadgets • Example: IBM Desktop Widget http://www.ibm.com/webaccessories/us/en/ • Tools (Bring more complex functionalities to help build integrated experience) • Google mashup editor (http://code.google.com/) • Yahoo pipes • IBM QEDWiki (http://services.alphaworks.ibm.com/qedwiki/) IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  9. What is Mashups? (4) • Characters from users’ experience • Personalized content • Simple and easy to use and content on-demand • Highly secure • Data reusable • Fast to build, less expensive and quick value • Open innovation environment. • … IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  10. The relationship with Web Services (1) • Traditional Web Services based on XML and WSDL which normally being defined as SOAs is only one side of Mashups, it is heavy, inward and with big learning curve. It fits well for business and process management applications. • In the service ‘consumer’ world, the loosely coupled, lightweight services are highly needed. The RESTful service has been played the important role, it is outward and give a lot of control to users. It fits well for applications that people have the diverse cultures. • The RSS/ATOM feeds and JSON format have the big push for web 2.0 applications. IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  11. The relationship with Web Services (2) The new paradigm of Web application development goes far beyond the traditional Model-View-Controller (MVC) model. These new requirements dictate the needs for effective Web service support both on the server side via xml and on the client side via JSON. IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  12. Introduction of JSON (1) JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  13. Introduction of JSON (2): data example http://api.search.yahoo.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=XQuery&results=1&output=json&callback=showMyLiveResults showMyLiveResults({"ResultSet":{"totalResultsAvailable":"2887","totalResultsReturned":1,"firstResultPosition":1,"Result": [{"Title":"save_xquery.jpg","Summary":"of future plans for XQuery support saying that We will also make sure that if we ship XQuery in a future release in the .NET Framework, it will be compliant with the W3C recommendation . Since .NET Frameworks only ship every 3 or so years, cutting XQuery from this release will mean that we probably won't see XQuery in their core framework until 2009, and possibly never if","Url":"http:\/\/www.stylusstudio.com\/images\/save_xquery.jpg","ClickUrl":"http:\/\/www.stylusstudio.com\/images\/save_xquery.jpg","RefererUrl":"http:\/\/www.stylusstudio.com\/xquery\/save_xquery.html","FileSize":"48279","FileFormat":"jpeg","Height":"242","Width":"450","Thumbnail":{"Url":"http:\/\/re3.mm-a8.yimg.com\/image\/4180184069","Height":"75","Width":"140"}}] }}) IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  14. Introduction of JSON (3) JSON is built on two structures object: A collection of name/value pairs. The group of object members and values is presented in {}. array: An ordered list of values. The array is presented in [] IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  15. Introduction of JSON (4) • Data and Data type • Expressions • … … • See http://www.json.org/ IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  16. Introduction of JSON (5) • Sample (simple) {"results":null} {"results":true} {"results":5} {"results":"nice"} IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  17. Introduction of JSON (6) • Sample from Google http://www.google.com/calendar/feeds/developer-calendar@google.com/public/full?alt=json-in-script&callback=listEvents IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  18. Introduction of JSON (7) • Sample for National Language Support {"results":[{ “welcome message":"\\u6b22\\u8fce", “country”:“cn”, “language”:”zh”}]} IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  19. Introduction of JSON (8) • Why JSON is becoming important in the Web 2.0 world technically? • Simple to use (data and data types) • Can be process by JavaScript. • Can be serialized over the web to over come the ‘same-origin’ policy of current browsers. IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  20. Introduction of JSON (9) XML vs. JSON Both XML and JSON are data change format,they have many similarities and differences. Following table show some details. IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  21. Introduction of JSON (10) IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  22. Introduction of JSON (11) Doing Web 2.0 Mashups application, to select right data format and to use the right API are extremely important for you to quickly bring up the valuable applications. People realize that JSON format is well fit into client side processing and the XML will be more efficient being used at server side, the combination of the two will make your Mashups easy to build and to maintain. IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  23. Introduction of XQuery (1) • XQuery Basics (XQuery is compatible with several W3C standards, such as XML, Namespaces, XSLT, XPath, and XML Schema. XQuery 1.0 has become the W3C recommendation in the beginning of 2007 ) • XQuery is the server language for querying XML data • XQuery for XML is like SQL for databases • XQuery is built on XPath expressions • XQuery is supported by all the major database engines (IBM, Oracle, Microsoft, etc.) IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  24. Introduction of XQuery (1-1) XPath basic • XPath has been used for path expressions in order to navigate in XML documents just like you are using a file system. • book all children of book • “/” /booklist all from root booklist • “//” //book anywhere book in doc • “/..” go up a level • “@” //book@category IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  25. Introduction of XQuery (2) • XQuery FLWOR Expressions FLWOR is an acronym for "For, Let, Where, Order by, Return". The for clause defines variables. The let clause declares variables. The where clause selects parts that actually interested. The order by clause defines sort order for output. The return clause tell system the last output IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  26. Introduction of XQuery (3) • XQuery functions • Standard functions • Collection() --- a set of documents • Doc() --- one document specific • Contains() , count(), max() , … … • http://www.w3.org/2005/02/xpath-functions • User defined functions IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  27. Introduction of XQuery (3) User defined functions declare function prefix:function_name ($parameter AS datatype) AS returnDatatype {(: ...function code here... :)}; declare function local:error_view($helpmsg as xs:string) { if($helpmsg) then $helpmsg else ('<report status="0"> Please call 1-800-123-4567 </report>') }; IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  28. Introduction of XQuery (4) • A sample XML <booklist> <book category="COOKING"> <title lang="en">Everyday Italian</title> <authors> <author>Giada De Laurentiis</author> </authors> <isbn></isbn> <numberCopies>1</numberCopies> <status>On Shelf</status> <year>2005</year> <library>Library 01</library> <price>30.00</price> </book> … </booklist> IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  29. Introduction of XQuery (5) • Sample query: let $doc := ('bookinfor/newbooks_library_01.xml') for $book in $doc/book where $book/title/@lang="en" order by $book/library return <tr> <td>{$book/library}</td> <td>{$book/title/text()}</td> <td>{$book/numberCopies}</td> <td>{$book/status}</td> </tr> IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  30. Introduction of XQuery (6) • Sample output <table> <tr> <td><library>John C. Hart Memory Library</library></td> <td>Web 2.0 in 24 Hours</td> <td><numberCopies>2</numberCopies></td> <td><status>Ordered</status></td> </tr> … </table> IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  31. Introduction of XQuery (7) • Call functions let $docs := ('bookinfor/book_collection.xml') for $doc in collection($docs)//booklist/book[contains(title,$title) and (year=$year)] where contains($doc//authors, $author) return $doc IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  32. Introduction of XQuery (8) • More -- define your own functions declare function html_view($doc) { <table> <tr> <td>Library Name</td> <td>Book Title</td> <td>Number of Copies</td> <td>Status</td> </tr> { for $book in $doc/book where $book/title/@lang="en" order by $book/library return <tr> <td>{$book/library}</td> <td>{$book/title/text()}</td> <td>{$book/numberCopies}</td> <td>{$book/status}</td> </tr> } </table> }; IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  33. Build your own Mashups (1) – Hands-on • By using Yahoo’s JSON API • By using Google’s JSON API • By using both Yahoo’s and Google’s API • By developing your own XQuery Mashups • Introduction IBM DB2 Viper and its XML processing features. IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  34. Build your own Mashups (2) – Hands-on • Develop your own XQuery Mashups • Architecture and application design • Prepare the server side XQuery • Prepare your JSON API • Do the client side html and JavaScript • Final integration. (see reference publication) IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  35. Build your own Mashups (2) – Hands-on Architecture & design IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  36. Build your own Mashups (3) • Introduction IBM DB2 Viper • New storage techniques for efficient management of hierarchical structures inherent in XML documents • New indexing technology to speed searches across and within XML documents • New query language support (for XQuery), a new graphical query builder (for XQuery), and new query optimization techniques • New support for validating XML data based on user-supplied schemas • Introduction pureXML: a tour IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

  37. Main References: • Ning Yan, ‘Using XQuery to Power Your Mashups’, http://www.ibm.com/developerWorks, July 2006 • http://www.json.org/ • http://www.w3.org/TR/xquery/ • ‘Understanding Mashup Building Platforms for Business Applications, http://www.protosw.com/static/pdf/proto-mashup-whitepaper.pdf June 2007 • Cynthia M. Saracco, ‘Develop java application for DB2 XML data’ http://www.ibm.com/developerWorks, May 2006 • DB9: pureXML Overview and Quick Start, http://www.redbooks.ibm.com/redbooks/pdfs/sg247298.pdf, 2006 IEEE Congress on Services (SERVICES 2007) IEEE International Conference on Web Services (ICWS 2007) IEEE International Conference on Services Computing (SCC 2007)

More Related