简体   繁体   English

在Windows应用程序表单中调用Web服务

[英]Calling a web service in a windows application form

EDIT. 编辑。 I was adding it as a service reference instead of a web service reference (found by when adding a service refererence, go into advanced and down the bottom it should say "add web reference") , I didn't know that option existed as it's hidden away. 我添加它作为服务引用而不是Web服务引用(在添加服务引用时找到,进入高级和底部它应该说“添加Web引用”),我不知道该选项存在,因为它是藏起来。

I made a web service in c# .net. 我在c#.net上创建了一个Web服务。 Initially it wasn't calling because I thought that the web form didn't like the codebehind for the web form that is created in VS2012, so I took that out and just included the web service file itself. 最初它没有调用因为我认为Web表单不喜欢在VS2012中创建的Web表单的代码隐藏,所以我把它拿出来并且只是包含了Web服务文件本身。

I'm pretty sure the libraries were included when I visit the url of the service with wsdl, but it still won't seem to call the service to the form. 当我使用wsdl访问服务的url时,我很确定包含了库,但它似乎仍然无法将服务调用到表单中。

It displays some XML data and shows TestCypher as a workable service, so it should be working? 它显示了一些XML数据,并将TestCypher显示为可行的服务,因此它应该有效吗? I'm not entirely sure where the wsdl file should be hosted if I take the web service out of the solution 如果我从解决方案中取出Web服务,我不完全确定应该托管wsdl文件的位置

Please see the below link 请参阅以下链接

http://www.codeproject.com/Articles/26941/Consuming-Webservice-In-A-Windows-Application http://www.codeproject.com/Articles/26941/Consuming-Webservice-In-A-Windows-Application

you can use this method in your application. 您可以在您的应用程序中使用此方法。 I just post this example in your requirement. 我只是在你的要求中发布这个例子。

please note : i have no guarantee about the perfomrnce area in this method. 请注意:我无法保证此方法中的性能区域。

So please consider this element when your application is use a wide number of users. 因此,当您的应用程序使用大量用户时,请考虑此元素。

Hope it help. 希望它有所帮助。

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

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