Solved

Currencies Converter Web Service

Posted on 2014-04-02
4
618 Views
Last Modified: 2014-04-03
Hi experts,

I had found a web service to get a change rate between two given currencies.
It first works good, but now (after a host transfer and other minor modifications) I get the message « Web service operation ConversionRate with parameters {GBP,EUR} cannot be found.  ».

Am I doing something wrong ? Web service has changed ?

I have look at the web service provider’s website, but they don’t have many documentation and it is very technical. I am little lost.

Here is the code I use :
	<cfset application.exchangeRate.EURtoUSD = -1>
	<cfset application.exchangeRate.USDtoEUR = -1>
	<cfset application.exchangeRate.GBPtoUSD = -1>
	<cfset application.exchangeRate.USDtoGBP = -1>
	<cfset application.exchangeRate.GBPtoEUR = -1>
	<cfset application.exchangeRate.EURtoGBP = -1>
	<cfset local.service = createObject("webservice", "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL")>
	<cfset local.fromCurrency = "GBP">
	<cfset local.toCurrency = "EUR">
	<cfloop condition="application.exchangeRate.GBPtoEUR EQ -1"> <cfset application.exchangeRate.GBPtoEUR = local.service.ConversionRate(local.fromCurrency, local.toCurrency)> </cfloop>
	<cfloop condition="application.exchangeRate.EURtoGBP EQ -1"> <cfset application.exchangeRate.EURtoGBP = local.service.ConversionRate(local.toCurrency, local.fromCurrency)> </cfloop>
	<cfset local.fromCurrency = "GBP">
	<cfset local.toCurrency = "USD">
	<cfloop condition="application.exchangeRate.GBPtoUSD EQ -1"> <cfset application.exchangeRate.GBPtoUSD = local.service.ConversionRate(local.fromCurrency, local.toCurrency)> </cfloop>
	<cfloop condition="application.exchangeRate.USDtoGBP EQ -1"> <cfset application.exchangeRate.USDtoGBP = local.service.ConversionRate(local.toCurrency, local.fromCurrency)> </cfloop>
	<cfset local.fromCurrency = "EUR">
	<cfset local.toCurrency = "USD">
	<cfloop condition="application.exchangeRate.EURtoUSD EQ -1"> <cfset application.exchangeRate.EURtoUSD = local.service.ConversionRate(local.fromCurrency, local.toCurrency)> </cfloop>
	<cfloop condition="application.exchangeRate.USDtoEUR EQ -1"> <cfset application.exchangeRate.USDtoEUR = local.service.ConversionRate(local.toCurrency, local.fromCurrency)> </cfloop>

Open in new window


Thanks a lot for your help.

Adam
0
Comment
Question by:adam1h
  • 2
  • 2
4 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 39972485
Are you using CF10 by any chance?  I ran your code and got that same error w/CF10, due to a change from Axis 1 =>v2.

It works if you set the version back to 1. The 1st time you run it, add "refreshWSDL=true" to generate new stubs. After that you can remove it and use only "wsversion=1"

<cfset args = {refreshWSDL=true, wsversion=1}>
<cfset local.service = createObject("webservice"
               , "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"
              , args)>
...
0
 

Author Comment

by:adam1h
ID: 39973093
Hi agx,

Indeed we have changed our host and we are now on a cf10 server.

I will try this fix tomorrow.

Thanks
0
 

Author Closing Comment

by:adam1h
ID: 39974494
A great thank you _agx_ , it works perfectly :-)
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39975381
I'm not sure why they chose to default web services to Axis2 instead of 1, like in CF9. Seems to have broken a lot of code like yours ... but glad that fixed it :)
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Weird Behavior in ColdFusion 8 80
HTTP POST URL 2 101
base64 Image - HTTP Error 414. The request URL is too long. 4 213
cfscript coding help 4 25
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
New Relic recently released its Synthetics product that allows for the creation of performance monitors that periodically test a site's performance. If you wish to test an interactive workflow New Relic employs Selenium WebDriverJS to run those test…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question