Solved

Currencies Converter Web Service

Posted on 2014-04-02
4
613 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
The task of choosing a web design company to build a website for your business should never be taken in a light manner. Provided the fact that your website will act as a representative to your business and will be responsible for imposing an online …
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now