.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> Web Services >> Post New Resource Bookmark and Share   

 Subscribe to Articles

How to consume a third Party Web service (C#)

Posted By:Sajid P K       Posted Date: October 11, 2010    Points: 50    Category: Web Services    URL: http://www.dotnetspark.com  

This article will talk about consuming third party web service in your web application. In this we will go by step by step approach.
 

About Third Party Web Service

In this Demo we have using A Third Party web service for getting Currency conversion rate from one currency to another currency

Web Service URL: http://www.webservicex.com/CurrencyConvertor.asmx?wsdl
Input: Two Currencies
Output: Exchange Rate

Sample Application

Out put of the application will be as shown in the picture below. It just calculates the exchange rate of currancy1 and currency2 and show in 4th column.





Step to consume

1) Create ASP.Net Project
2) Goes to explorer solution and Right Click on the root site and later click in add Web reference. See below image



3) Then a window will open as show in below image.




4) On URL textbox, Type http://www.webservicex.com/CurrencyConvertor.asmx?wsdl. This our Web Service URL

5) Change the Web Reference name "Rate_WS". "Rate_WS" will be the namespace for accessing our CurrencyConvertor

6) Click in the add web reference button

Now our application is ready for accessing the CurrencyConvertor webservice.



protected void Page_Load(object sender, EventArgs e)
{
Rate_WS.CurrencyConvertor ExRate = new Rate_WS.CurrencyConvertor();

lblEuroUsd.Text = ExRate.ConversionRate(Rate_WS.Currency.EUR, Rate_WS.Currency.USD).ToString() ;

lblINRUSD.Text = ExRate.ConversionRate(Rate_WS.Currency.INR, Rate_WS.Currency.USD).ToString();

lblInrEuro.Text = ExRate.ConversionRate(Rate_WS.Currency.INR, Rate_WS.Currency.EUR).ToString();

}


 

 Subscribe to Articles

     

Further Readings:

Responses
Author: Chaitanya Kiran         Company URL: http://www.dotnetspark.com
Posted Date: May 28, 2013

hi sajid....i am getting the exception "WebException was unhandled by the user code. The request failed with HTTP status 417: Expectation failed."..How can i resolve this exception..give me your valuable suggestion...thanks in advance..

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend