如何在我的网站上调用Web服务? [英] How to invoke web service into my website?

查看:68
本文介绍了如何在我的网站上调用Web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在为黄金商人开发网站。根据项目要求,我想在网站上添加实时黄金价格。我找到了一个免费的网络服务来获得实时黄金价格。但我是网络服务的新手,我不知道如何使用网络服务,请告诉我如何在我的网站上使用网络服务。请查看以下链接,了解我如何使用以及如何从以下Web服务获得价格。在此先感谢...



实时黄金价格网络服务链接在这里....



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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆