Where can I get real time exchange rates? [resolved]
Hey there
I'm building a web app that needs a currency converter, and at the moment all I can think of is getting hold of real time exchange rates and then doing the math from there. Is this the best way of doing it? I will be storing only one currency in the database. How can I get hold of these exchange rates? I've heard theres a web service out there that supplies them, but i'm not sure where that is.
Any help will be much appreciated!
Thanks
Re: Where can I get real time exchange rates?
http://www.cloanto.com/currencyserver/
I searched on google for this so no idea what its like but im guessing its the sort of thing you are after
Re: Where can I get real time exchange rates?
cool thanks :thumb:
I found that web service I mentioned. You can give it two countries and it returns the up-to-date exchange rate. Quite neat.
Here it is if anyone is curious:
http://www.xmethods.net/sd/2001/Curr...geService.wsdl
Re: Where can I get real time exchange rates? [resolved]
No worries. I may actually need this for my site.
As I haven't used web-services before/yet - do you think you could post a code example please? :bigyello:
Re: Where can I get real time exchange rates? [resolved]
All you gotta do is add the web reference to your solution (Project --> Add Web Reference...). Search for the web service and select add reference.
The function I'm using at the moment is this:
Code:
Public Function getERate(ByVal country1 As String, ByVal country2 As String) As Single
Dim CEService As net.xmethods.www.CurrencyExchangeService
Dim sngCurr As Single
If (Not country1 = String.Empty) And (Not country2 = String.Empty) Then
'instantiate web service
CEService = New net.xmethods.www.CurrencyExchangeService
Try
'get the e-rate from web service
sngCurr = CEService.getRate(country1, country2)
Return sngCurr
Catch ex As Exception
Return Nothing
End Try
End If
Return Nothing
End Function
Re: Where can I get real time exchange rates? [resolved]
Thats great, thanks v.much :thumb:
Re: Where can I get real time exchange rates? [resolved]
Quote:
Originally Posted by Patch21
All you gotta do is add the web reference to your solution (Project --> Add Web Reference...). Search for the web service and select add reference.
The function I'm using at the moment is this:
Code:
Public Function getERate(ByVal country1 As String, ByVal country2 As String) As Single
Dim CEService As net.xmethods.www.CurrencyExchangeService
Dim sngCurr As Single
If (Not country1 = String.Empty) And (Not country2 = String.Empty) Then
'instantiate web service
CEService = New net.xmethods.www.CurrencyExchangeService
Try
'get the e-rate from web service
sngCurr = CEService.getRate(country1, country2)
Return sngCurr
Catch ex As Exception
Return Nothing
End Try
End If
Return Nothing
End Function
this seems cool, i got error on those bold word and it say not defined? anyone can help or got other better currency converter codings?
Re: Where can I get real time exchange rates? [resolved]
net.xmethods.www.CurrencyExchangeService is a ref to a webservice.
Look at post #3, #4 and #5 in this thread.
You also may want to look up how to use webservices oin the web.
Woka
Re: Where can I get real time exchange rates? [resolved]
Quote:
Originally Posted by Wokawidget
net.xmethods.
www.CurrencyExchangeService is a ref to a webservice.
Look at post #3, #4 and #5 in this thread.
You also may want to look up how to use webservices oin the web.
Woka
I already follow but got that error. the Web ref name should be what? I keep changing and it now give me this Type expected message.
Re: Where can I get real time exchange rates? [resolved]
When u setup a web service in your app you assign it a "Web Reference Name", this is what u use to asses the web service, ie if I called it Woof then I would do:
VB Code:
Dim MyWebService As new Woof
Woka
Re: Where can I get real time exchange rates? [resolved]
Quote:
Originally Posted by Wokawidget
When u setup a web service in your app you assign it a "Web Reference Name", this is what u use to asses the web service, ie if I called it Woof then I would do:
VB Code:
Dim MyWebService As new Woof
Woka
Thanks Woka. finally it works :) its because last time I download the web reference and save it into my root and I got mess up, this time I just add web reference directly from the URL and I see the default web reference name so I understand what you mean already.
Anyway, now no error but I just need a simple currency converter that just convert a few country to country, what should I do now to setup a basic currency converter with that code loaded?