简体   繁体   English

在C#Windows应用程序中使用Web服务

[英]Use a Web Service in C# Windows App

I am new to using web services. 我是使用Web服务的新手。 I am assigned a task in which I need to use a web service in my Windows app. 我被分配了一个任务,我需要在我的Windows应用程序中使用Web服务。 This is the web service I would be using: https://api.betfair.com/global/v3/BFGlobalService.wsdl 这是我将使用的Web服务: https//api.betfair.com/global/v3/BFGlobalService.wsdl

Now, I've learned how to add a web reference to this service, but I could not find a basic tutorial that could help me learn how to make an object of this web service and use the service as I want to. 现在,我已经学会了如何为这项服务添加一个Web引用,但我找不到一个基本的教程,可以帮助我学习如何制作这个Web服务的对象并按我的意愿使用该服务。

Basicaly, what I need is to create an object from the above web service in my form, and to call it's methods. 基本上,我需要的是在我的表单中从上面的Web服务创建一个对象,并调用它的方法。 AC# code snippet would be great. AC#代码片段会很棒。

Can anyone give me some directions? 谁能给我一些指示? I am working in Visual Studio 2008 and a C# Windows App. 我在Visual Studio 2008和C#Windows应用程序中工作。

  1. Right click on References 右键单击References
  2. select Add Service Reference 选择添加服务参考
  3. give the wsdl address in the address textbox 在地址文本框中提供wsdl地址
  4. click Discover 单击发现
  5. Give a name for the namespace eg;- BFG 给命名空间命名,例如: - BFG
  6. You can access the resources like BFG.MethodName() from you code 您可以从代码中访问BFG.MethodName()等资源

Please look at the following link for a sample application of consuming C# WEb Service in Win App, 请查看以下链接,了解在Win App中使用C#WEb服务的示例应用程序,

http://www.codeproject.com/Articles/2761/Consuming-Web-Services-from-a-Win-Forms-Applicatio http://www.codeproject.com/Articles/2761/Consuming-Web-Services-from-a-Win-Forms-Applicatio

for consuming a web service here is the steps for that.see it.,from there you will get your solution. 对于消费网络服务,这里是步骤。看到它,从那里你将得到你的解决方案。

click here 点击这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM