Using Web Services in Your Gadget/Widget

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Using Web Services in Your Gadget/Widget - Presentation Transcript

    1. Using Web Services in your Gadget Alan Lewis – eBay Technical Evangelist NGW024
    2. Hi
    3. I lost my voice earlier this morning
    4. :-(
    5. I have some cool stuff to show you though
    6. :-)
    7. So, I’ll give it a try
    8. Here goes…
    9. Huh? What’s this presentation about???
      • Web Services
        • You may have heard of them
        • Yes, they are actually useful
        • No, you don’t have to use SOAP
        • Lots of services are out there for you to use (finally)
      • Gadgets
        • Or Widgets
        • Or Plugins
        • Or Panels
        • Definition: “mini-applications that let you perform common tasks and provide you with fast access to information”
        • Translation: They do cool stuff
    10. Why Should I Care?
      • Gadgets are cool
      • Web services offer lots of reusable data and functionality
      • MIXing them up (nice plug) in your gadget saves you headaches
      • Alternative to doing it this way – server side coding
        • Need to scale your server to handle traffic from gadget
        • Different skill set required
        • Eww!!!
    11. So, what sorts of web services are out there?
      • I’m so glad you asked… here is a totally random example:
      • eBay Web Services!!!
      • Please permit me a short detour to summarize
    12. eBay Web Service Features
      • Search
      • Listing Items
      • Transaction/Order Management
      • My eBay
      • eBay Stores
      • Feedback Management
      • Watch List
      • Bidding (with signed agreement)
      • In short, almost everything you can do on the site
    13. Different Flavors of eBay Web Services
      • SOAP
      • XML (HTTP POST)
        • Both support the same feature set (all calls)
        • Calls go over HTTPS
      • REST (HTTP GET)
        • supports GetSearchResults call
    14. Sample Call Request
      • XML API:
      • <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?>
      • <GetSearchResultsRequest xmlns=&quot;urn:ebay:apis:eBLBaseComponents&quot;>
      • <RequesterCredentials>
      • <eBayAuthToken>ABC123</eBayAuthToken>
      • </RequesterCredentials>
      • <Query>iPod Nano</Query>
      • </GetSearchResultsRequest>  
      • REST API
      • http://rest.api.ebay.com/restapi?CallName=GetSearchResults&RequestToken=ABC123=&RequestUserId=alanlewis0&Query=iPod%20Nano&Schema=1
    15. Sample Call Response
      • XML API and REST API (same response)
      • <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?>
      • <GetSearchResultsRequest xmlns=&quot;urn:ebay:apis:eBLBaseComponents&quot;>
      • <Item>
      • <ItemID>4036874357</ItemID>
      • …   
      • <SellingStatus>
      • <BidCount>31</BidCount>
      • <CurrentPrice currencyID=&quot;USD&quot;>80.0</CurrentPrice>
      • </SellingStatus>
      • <Site>US</Site>
      • <Title>Used Apple iPod Nano MP3 Player Good Condition</Title>
      • </Item>
      • </GetSearchResultsRequest>  
    16. And Now… Demo
    17. Live.com
      • Supports RSS feeds and Gadgets
      • Gadgets are implemented in javascript + CSS
      • Still alpha feel – emerging feature set and very buggy at times (especially with CSS support)
    18. Design Philosophy
      • Gadgets call for a fresh design approach
      • Sort of like code for mobile devices
        • Limited screen real-estate
        • Limited functionality/APIs
      • Except not
        • Still coding for the browser– multiple windows/tabs, cross-browser issues
        • Asynchronous interaction, more bandwidth
    19. Challenge 1: Security Restrictions
      • Calls can’t go across domains
        • If the gadget was served up from www.mydomain.com, can’t call api.ebay.com
      • Live.com solution to this: proxy!
        • Supports XML data (except XHTML) and RSS feeds
        • Currently only supports HTTP GET (contrary to docs – support for POST will be added in the future)
        • Can’t proxy HTTPS yet, so only option for eBay is REST API
        • var r = Web.Network.createRequest(
        • Web.Network.Type.XML,
        • searchQuery,
        • {proxy:&quot;generic&quot;},
        • eBaySearchCallback);
    20. Challenge 2: Namespaces
      • IE javascript engine can’t handle XML data in default namespaces
      • Solution: Use ugly RegEx hack to remove namespace:
      • var rootText = response.responseText;
      • var re = /xmlns=&quot;urn:ebay:apis:eBLBaseComponents&quot;/g;
      • rootText = rootText.replace(re, &quot;&quot;);
      • var responseWithoutNamespaces;
      • if (window.ActiveXObject) {
      • responseWithoutNamespaces = new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);
      • responseWithoutNamespaces.async=&quot;false&quot;;
      • responseWithoutNamespaces.loadXML(rootText);
      • }
      • else {
      • responseWithoutNamespaces = document.implementation.createDocument(&quot;&quot;,&quot;&quot;,null);
      • responseWithoutNamespaces.loadXML(rootText);
      • }
    21. And now…
      • ANNOUNCING:
      • The gadget is open sourced
      • Commercial software-friendly open source license: CDDL
      • Yeah!
      • http://searchgadget.codebase.ebay.com
      • Lets go check it out…
    22. Now More Code
      • Here is the code, in-depth
    23. Other Web Services
      • Lots to choose from: www.programmableweb.com
      • REST is very popular, but has limitations
      • RSS feeds are web services too
    24. Building Commercial Apps
      • One issue to keep in mind is many Web services out there force non-commercial use
      • Shameless plug: that’s not the case with eBay Web services
      • One way to make money with your Gadget is to use an affiliate program like eBay’s: http://developer.ebay.com/affiliates
    25. Other Gadget/Widget Platforms
      • Vista Sidebar
        • Bundled with Vista, but limited capabilities (thusfar)
      • Yahoo! Widget Engine (Konfabulator)
        • Multi-platform support, integration with Desktop still clumsy
      • Apple Dashboard
        • Best desktop integration, but only for OSX
      • Google Desktop – (Sidebar)
        • Information-rich widgets, but harder to build, bundled with a product IT departments hate
      • Google Personalized Home Page
        • Sorta like live.com – less functionality but better visibility
    26. Learn More Stuff
      • More on eBay Web Services: http://developer.ebay.com Its totally free!
      • eBay Developers Conference, baby! June 10-12, Mandalay Bay, Las Vegas
      • Live.com eBay Gadget available in the Gallery: microsoftgadgets.com
      • Open sourced at: http://searchgadget.codebase.ebay.com
      • Sanaz Ahari’s presentation immediately following this one, in C/D

    + goodfridaygoodfriday, 8 months ago

    custom

    600 views, 0 favs, 0 embeds more stats

    Gadget/Widget platforms, such as live.com, have a n more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 600
      • 600 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 7
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories