Consuming popular web services - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Consuming popular web services

Description:

Head of House of Fusion. Publisher of Fusion Authority. Founding member of Team Macromedia ... Soap is cleaner' here. What is SOAP? SOAP. Simple Object Access Protocol ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 19
Provided by: michae1565
Category:

less

Transcript and Presenter's Notes

Title: Consuming popular web services


1
Consuming popular web services
  • Amazon, Ebay and Google at your fingertips

2
Who am I
  • Michael Dinowitz
  • Head of House of Fusion
  • Publisher of Fusion Authority
  • Founding member of Team Macromedia
  • Using ColdFusion since June 1995

3
Evolution
  • Web is data formatted for humans
  • For humans by humans
  • Good for people, bad for software
  • Need to transfer data by hand

4
Evolution
  • Screen Scraping
  • Removing UI and human layer from data
  • Complex
  • Breaks on any change to UI

5
Evolution
  • CFHTTP to get the data
  • RegEx to parse it
  • sItemREFindNoCase('lta href"http//cgi\.ebay\.com
    /ws/eBayISAPI\.dll\?ViewItemampcategory(0-9)
    ampitem(0-9)gtgt(lt)lt/agt\(\lt)
    lt(a-z3,5-0-9)',
    CFHTTP.FileContent, Start, 1)

6
Next level
  • Remove people from the equation
  • Content for software by software
  • Data in XML over HTTP
  • Referred to as REST (Representational State
    Transfer)
  • Not complex at all

7
REST
  • CFHTTP to get content
  • XML functions to parse content
  • http//api.search.yahoo.com/WebSearchService/V1/we
    bSearch?appidYahooDemoquerycoldfusionresults2
    0
  • Example Code

8
Segue
  • PaypalMX Paypal web services
  • http//www.web-relevant.com/
  • Uses REST multipart REST
  • Paypal REST is overly complex
  • Soap is cleaner here
  • What is SOAP?

9
SOAP
  • Simple Object Access Protocol
  • Object like access to web services
  • Overly complex in ways
  • Connects to a WSDL template
  • Web Services Description Language
  • Still XML, but hidden

10
Basics Connect
  • Uses CFINVOKE, CFOBJECT or CreateObject() to
    connect

11
CFINVOKE
  • Calls a web service directly
  • Uses CFINVOKEARGUMENT to pass arguments
  • Returns a single variable
  • One method call per invoke

12
CFINVOKE Example
  • ltcfinvoke   
  • webservice"http//www.xmethods.net/sd/2001/Temper
    atureService.wsdl"   
  • method"getTemp"   
  • returnvariable"aTemp"gt     
  • ltcfinvokeargument name"zipcode" value"55987"gt
  • lt/cfinvokegt
  • ltcfoutputgtThe temperature is aTemplt/cfoutputgt

13
CreateObject() Example
  • Connects to service
  • Calls methods separately
  • Can invoke multiple methods per connection
  • ltcfscriptgt
  • ws CreateObject("webservice",
    "http//www.xmethods.net/sd/2001/TemperatureServic
    e.wsdl") xlatstring ws.getTemp(zipcode
    "55987")
  • writeoutput("The temperature is " xlatstring)
  • lt/cfscriptgt

14
CFOBJECT
  • Same as CreateObject() but uses the tag

15
Issues
  • Security
  • Getting service ID from vendor
  • Read the docs!!!!

16
Amazon
17
Google
18
Ebay
Write a Comment
User Comments (0)
About PowerShow.com