> Has anyone  managed to consume a Currency Conversion web
> service under CFMX yet?

Don't know if it'll help, but...

We don't need totally up to date currency information so I have a
scheduled task to run twice a day and, using an xMethods web service,
update our local copy of the rates we use.  Then when a conversion is
required (all are "from" GBP) we do the calculation locally.

Basic code below to call the webservice:

<!--- set where we're starting from --->
<cfset local = "uk">

<!--- and the list of currencies to retrieve --->
<cfset countrykeys = structnew()>
<cfset countrykeys["US"] = "us">
<cfset countrykeys["FR"] = "euro">
<cfset countrykeys["ES"] = "euro">
<cfset countrykeys["IE"] = "euro">
<cfset countrykeys["JP"] = "japan">
<cfset countrykeys["CA"] = "canada">
<cfset countrykeys["AU"] = "australia">

<!--- get the service stub --->
<cfset wsrate = createobject("webservice",
"http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl")>

<!--- loop through each country --->
<cfloop collection="#countrykeys#" item="key">
    <!--- get the new ex rate --->
    <cfset exrate = wsrate.getRate(local, countrykeys[key])>
    <!--- output the new values --->
    <cfoutput>#key# (#countrykeys[key]#) = #exrate#<br></cfoutput>
    <!--- 1 by 1 --->
    <cfflush>
</cfloop>

Tim.

--
-------------------------------------------------------
<CF_CodingContest mode="judging" newentries="false">
Maze Solver - http://tech.badpen.com/cfcontest/
-------------------------------------------------------
RAWNET LTD - Internet, New Media and ebusiness Gurus.
WE'VE MOVED - for our new address, please visit our
website at http://www.rawnet.com/ or call us any time
on 0800 294 24 24.
-------------------------------------------------------
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
-------------------------------------------------------
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to