5,692,513 members and growing! (15,537 online)
Email Password   helpLost your password?
Web Development » ASP.NET » General     Beginner

Currency Conversion using Web Services

By Britney S. Morales

This article is to teach how to implement the currency converter Web Service from www.xmethods.net in order to get the exchange rates between countries' money
C# 1.0, C# 2.0, C#Windows, .NET, .NET 1.1, .NET 2.0, WinXP, ASP.NET, WebForms, VS.NET2003, VS2005, Visual Studio, Dev

Posted: 5 Sep 2006
Updated: 9 Nov 2006
Views: 30,183
Bookmarked: 16 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
11 votes for this Article.
Popularity: 2.78 Rating: 2.67 out of 5
3 votes, 27.3%
1
2 votes, 18.2%
2
0 votes, 0.0%
3
2 votes, 18.2%
4
4 votes, 36.4%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Introduction

I was navigating the web looking for a currency converter between the different countries money, finally, I found an article from Phil Williams who explain a Currency Conversion using web Services, so I based this ASP.NET example in that article and I try to make a little bit easy the implementation using the ASP.NET environment. You will find the original article in google using the sentence, "Currency Conversion using Web Services by Phil Williams." Already the presentation, now lets focus in the program. This article is to teach how to implement the currency converter Web Service from the http://www.xmethods.net/ in order to get the exchange rates between countries money, the countries list is in the xmethods website.

First

Start a new asp.net project. In the web form you must to create three labels, their name are Trm (it will show the US dollars at Colombians Pesos), Euro(Same Case but with Euro), Euro_Us(Euro in dollar).

Second

The second step is to add the web service reference to third part Web Service, How?? Goes to explorer solution, do right click over the root site, later click in add Web reference.

Check the image 1

Sample screenshot

Sorry about the Spanish language, that's my mother language. In this page you must to write the web Service url address, and click in go. The URL is http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl. Now you will see all the implements methods for this Web Service, this WS just have one, GetRate() Web Method.

  • Change the Web Reference name to Any String, in this case will be Rate_WS.
  • Click in the add web reference button.
Sample screenshot

Add web reference wizard

Now it's already the Web Service reference to third party program, you are able to invoice the GetRate() method from your program.

Third

At the page_load event add the next lines.

protected void Page_Load(object sender, EventArgs e)

{

try{

Rate_WS.CurrencyExchangeService to_currency = new Rate_WS.CurrencyExchangeService();

float euro_us = to_currency.getRate("euro", "united states");

float us_pesos = to_currency.getRate("united states", "colombia");

float euro_pesos = to_currency.getRate("euro", "colombia");

Trm.Text = us_pesos.ToString();

Euro.Text = euro_pesos.ToString();

Euro_Us.Text = euro_us.ToString();

}

catch(Exception){}

}

Change the countries names for any you want, the list of countries support is in http://www.xmethods.net/. This is an easy implementation for a basic web service, fell free to make any changes.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Britney S. Morales


Web Developer during 3 years and counting, i worked over my school website by two years, right now im webmaster at World Wowan foundation banking in my home city.

Please forgive my pictures examples, they are at spanish language because its my mother language.


Occupation: Web Developer
Location: Colombia Colombia

Other popular ASP.NET articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 31 (Total in Forum: 31) (Refresh)FirstPrevNext
GeneralNO hay problemamembervladi100010:17 20 Nov '08  
GeneralOther URL [modified]memberZwerver23:44 14 Sep '08  
GeneralWeb Service given by u is not workingmembervasavi.polisetty23:40 13 Jul '08  
GeneralRe: Web Service given by u is not workingmemberjuand1612:13 20 Aug '08  
GeneralWeb Service not connecting..membersircutbreaker.com8:40 27 Nov '07  
Generalproblem with the service linkmembersandeepram3:10 15 Nov '07  
GeneralGorgeousmemberAvi duke3:54 17 Jul '07  
GeneralRe: GorgeousmemberBritney S. Morales5:43 28 Sep '07  
GeneralProblem while implementing same webservice for windows based Device apllicationmembershakthi_nandivada15:46 26 Jun '07  
GeneralRe: Problem while implementing same webservice for windows based Device apllicationmemberBritney S. Morales11:57 27 Jun '07  
GeneralRe: Problem while implementing same webservice for windows based Device apllicationmembershakthi_nandivada17:32 27 Jun '07  
Generalnice examplemembermarwamay0:21 10 Jun '07  
GeneralRe: nice examplememberBritney S. Morales10:38 12 Jun '07  
GeneralGecamemberGeca3:47 25 May '07  
GeneralRe: GecamemberBritney S. Morales10:37 12 Jun '07  
GeneralClean and simplemember22:28 29 Jan '07  
Generalhellomemberchernobyl17:33 24 Jan '07  
GeneralRe: hellomemberBritney S. Morales2:11 25 Jan '07  
GeneralNice example on web servicememberSheel Gohe6:37 9 Jan '07  
GeneralRe: Nice example on web servicememberBritney S. Morales11:29 9 Jan '07  
GeneralCode not workingmemberLeonXWizard5:35 1 Dec '06  
GeneralRe: Code not workingmemberBritney S. Morales6:40 1 Dec '06  
GeneralI prefer to use this Web ServicememberAndri Yadi22:14 26 Nov '06  
GeneralRe: I prefer to use this Web ServicememberMunni116:05 28 Sep '07  
GeneralCode? what Code? I am just here to look at her picture.memberrishen sukai20:54 23 Nov '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 9 Nov 2006
Editor:
Copyright 2006 by Britney S. Morales
Everything else Copyright © CodeProject, 1999-2008
Web16 | Advertise on the Code Project