Solved

Currencies Converter Web Service

Posted on 2014-04-02
4
622 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

622 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