120 likes | 251 Views
Consuming popular web services. Amazon, Ebay and Google at your fingertips. Who am I. Michael Dinowitz Head of House of Fusion Publisher of Fusion Authority Founding member of Team Macromedia Using ColdFusion since June 1995. What are web services. Data without the user interface
E N D
Consuming popular web services Amazon, Ebay and Google at your fingertips
Who am I • Michael Dinowitz • Head of House of Fusion • Publisher of Fusion Authority • Founding member of Team Macromedia • Using ColdFusion since June 1995
What are web services • Data without the user interface • Formatted in XML • Delivered directly • Pre-stored in a structured format when retrieved
Basics: Connect • Uses CFINVOKE, CFOBJECT or CreateObject() to connect
CFINVOKE • Calls a web service directly • Uses CFINVOKEARGUMENT to pass arguments • Returns a single variable • One method call per invoke
CFINVOKE Example • <cfinvoke • webservice="http://www.xmethods.net/sd/2001/TemperatureService.wsdl" • method="getTemp" • returnvariable="aTemp"> • <cfinvokeargument name="zipcode" value="55987"> • </cfinvoke> • <cfoutput>The temperature is #aTemp#</cfoutput>
CreateObject() Example • Connects to service • Calls methods separately • Can invoke multiple methods per connection • <cfscript> • ws = CreateObject("webservice", "http://www.xmethods.net/sd/2001/TemperatureService.wsdl"); xlatstring = ws.getTemp(zipcode = "55987"); • writeoutput("The temperature is " & xlatstring); </cfscript>
CFOBJECT • Same as CreateObject() but uses the tag
Issues • Security • Getting service ID from vendor • Read the docs!!!!