简体   繁体   English

如何创建和执行.net Web服务客户端?

[英]How to create and execute .net web service clients?

I need to create and execute a C#.net client that consumes a web service (wsdl). 我需要创建并执行使用Web服务(wsdl)的C#.net客户端。

I have used the wsdl.exe tool: 我已经使用了wsdl.exe工具:

wsdl.exe /language:CS /out:c:\myTests\ http://localhost:8080/myTestService.wsdl

getting as output a .cs file that contains several methods but no main. 作为输出得到一个.cs文件,该文件包含几种方法但没有main方法。

How do I create a client that invokes the remote method of the web service? 如何创建调用Web服务的远程方法的客户端?

with no prejudice on why you ask this question and why are you implementing this thing of the past, you might want to try this : 在不问您为什么要问这个问题以及为什么要实施过去的事情的情况下,您可能要尝试以下操作:

var client = new myTestService();
var result = client.AvailableMethod();

hope this helps. 希望这可以帮助。

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

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