通过ASP.NET上的SOAP调用Web服务的最简单方法

时间:2021-12-07 18:14:45

I have a webservice on a remote host that I need to invoke from ASP.NET/C# class. What is the simplest way of calling a method via SOAP, given WSDL url and a method signature?

我在远程主机上有一个web服务,我需要从ASP.NET / C#类调用。在给定WSDL url和方法签名的情况下,通过SOAP调用方法的最简单方法是什么?

Given: WSDL url as string(available only at runtime, i.e. variable) Method signature(constant)

给定:WSDL url为字符串(仅在运行时可用,即变量)方法签名(常量)

Need to: Create a soap client and perform method call.

需要:创建一个soap客户端并执行方法调用。

2 个解决方案

#1


4  

See here: http://msdn.microsoft.com/en-us/library/d9w023sx.aspx

请看这里:http://msdn.microsoft.com/en-us/library/d9w023sx.aspx

Its very easy in visual studio - you simply add the web reference url and it generates the proxy stub for you.

它非常容易在visual studio中 - 您只需添加Web引用URL并为您生成代理存根。

#2


6  

The simplest thing to do is to just use "Add Service Reference" and point to the WSDL. It will generate the proxy classes for you, including a proxy method which should match the method signature you've been given.

最简单的方法是使用“添加服务引用”并指向WSDL。它将为您生成代理类,包括一个代理方法,它应该与您给出的方法签名相匹配。

See if you find How to Consume a Web Service to be helpful.

看看你是否觉得如何使用Web服务是有帮助的。

#1


4  

See here: http://msdn.microsoft.com/en-us/library/d9w023sx.aspx

请看这里:http://msdn.microsoft.com/en-us/library/d9w023sx.aspx

Its very easy in visual studio - you simply add the web reference url and it generates the proxy stub for you.

它非常容易在visual studio中 - 您只需添加Web引用URL并为您生成代理存根。

#2


6  

The simplest thing to do is to just use "Add Service Reference" and point to the WSDL. It will generate the proxy classes for you, including a proxy method which should match the method signature you've been given.

最简单的方法是使用“添加服务引用”并指向WSDL。它将为您生成代理类,包括一个代理方法,它应该与您给出的方法签名相匹配。

See if you find How to Consume a Web Service to be helpful.

看看你是否觉得如何使用Web服务是有帮助的。