Wrox Programmer Forums
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 29th, 2008, 06:41 AM
Registered User
Join Date: Feb 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default to know Webservice

How to implement currency conversion webservice in my project? Please give some example


Old March 3rd, 2008, 01:16 PM
Authorized User
Join Date: Sep 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts

Nnngghhh! I wrote a long piece of text with couple of examples and accidentaly closed browser :(

But anyway. You have Visual Studio? If not, just skip the following...

Open VS and create new web service then write something like this (VS writes some of this for you):

[WebService(Namespace = "http://foo.bar")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
class CurrencyConverter : System.Web.Services.WebService
    public CurrencyConverter { }

    public decimal Convert(decimal value, string currencyFrom, string currencyTo)
        return 0; // Do your stuff here
Then just for practice and example add new Windows Forms project to your solution. Add Web Reference to your newly create Web Service (click add web reference and select 'web services in this solution' or something like that). Accept default settings, just clickety click away.

Then add textbox and button to your form. Double click button and write something like this:

decimal value = decimal.Parse(TextBox1.Text);
localhost.CurrencyConverter c = new localhost.CurrencyConverter();
value = c.Convert(value, "from", "to");
TextBox1.Text = value.ToString("0.##");

Similar Threads
Thread Thread Starter Forum Replies Last Post
Webservice listener dcrooks .NET Web Services 0 February 18th, 2005 05:33 PM
Help me about WebService hueduongit .NET Web Services 2 June 3rd, 2004 09:51 PM
webservice hanuyedluri .NET Web Services 1 March 21st, 2004 05:16 PM
Properties of WebService sakalou J2EE 0 February 3rd, 2004 02:08 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.