Your SlideShare is downloading. ×
0
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Using Web Services in Your Gadget/Widget
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Using Web Services in Your Gadget/Widget

2,268

Published on

Gadget/Widget platforms, such as live.com, have a natural integration with sites, such as eBay, using Web services. Gadgets are great for monitoring the status of ever-changing data; the eBay …

Gadget/Widget platforms, such as live.com, have a natural integration with sites, such as eBay, using Web services. Gadgets are great for monitoring the status of ever-changing data; the eBay marketplace is always in flux. However, there are unique challenges you will need to overcome in order to use Web services in your gadget, such as security constraints, authentication, data overload, and more. This breakout session discusses how to use Web services within live.com and similar platforms, and dives into some real-world examples of gadgets/widgets that use third-party Web services.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,268
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

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

×