如何在我的网站上调用Web服务? [英] How to invoke web service into my website?
问题描述
实时黄金价格网络服务链接在这里....
http://www.freewebservicesx.com/GetGoldPrice.asmx?op=GetCurrentGoldPrice [ ^ ]
将default.aspx页面添加到您的站点。
并添加两个用于输入用户名和密码的文本框和一个用于检查金币价格的按钮
然后右键单击References然后添加webreference如果它不存在
添加服务引用然后单击高级那里你可以看到添加web引用按钮并在url字段中给出这个url http://www.freewebservicesx.com/GetGoldPrice.asmx [ ^ ]
并添加对您网站的引用。
点击按钮添加以下代码
com.freewebservicesx.www.GetGoldPrice mys = new com.freewebservicesx.www.GetGoldPrice();
string a = firstnum.Text;
string b = secondnum.Text;
string [] c = mys.GetCurrentGoldPrice(a,b);
foreach ( var d in c)
{
ScriptManager.RegisterStartupScript( this ,GetType(), showalert, alert(' + d + ');,真跨度>);
}
运行你的申请表和
你必须在免费注册Web服务站点并在文本框中传递您的用户名和密码,然后单击按钮,然后您将获得金价警报。
您可以根据您的要求修改它
Hi everyone, I am developing website for gold merchant. As per project requirements, i want to add live gold price to website. I found one free web service to get live gold rate. but i am new to web services, I don't know how to use web service, please tell me how to use web service in my website. Please check the following link to how can i use and how can i get price from the following web service. Thanks in advance...
Live gold price web service link is here....
http://www.freewebservicesx.com/GetGoldPrice.asmx?op=GetCurrentGoldPrice[^]
Add a default.aspx page into your site.
and add two text boxes for entering username and password and one button to check gold price
and right click on References then add webreference if its not there
add service reference then click advanced there you can see add web reference button and give this url in url field http://www.freewebservicesx.com/GetGoldPrice.asmx[^]
and add reference to your site.
on button click add below code
com.freewebservicesx.www.GetGoldPrice mys = new com.freewebservicesx.www.GetGoldPrice(); string a=firstnum.Text; string b=secondnum.Text; string[] c = mys.GetCurrentGoldPrice(a, b); foreach (var d in c) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('"+d+"');", true); }
run your application and
You have to register in Free Web Service site and pass your username and password on the textboxes and click on button then you will get gold price as alert.
You can modify it as per your requirement
这篇关于如何在我的网站上调用Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!