Solved

Currencies Converter Web Service

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

919 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

18 Experts available now in Live!

Get 1:1 Help Now