如何调用外部服务器/ web服务的方法呢? [英] How to invoke methods on external server / webservice?

查看:355
本文介绍了如何调用外部服务器/ web服务的方法呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想援引 http://www.ibanbic.be/IBANBIC.asmx <方法/ A>

我已经读了很多论坛和教程,但所有的信息是建立在ASP.net web服务,或使用AJAX / JavaScript的。我只需要调用的函数。calculateIBAN1

一个教程一步一步将是真棒。

在此先感谢


解决方案

  

一个教程一步一步将是真棒。


在Solution Explorer中的参考菜单中的项目右击并选择添加服务引用... 。在地址键入 http://www.ibanbic.be/IBANBIC.asmx ,然后点击开始然后确定。这将产生一个强类型的客户端代理,让您调用该服务:

 使用(VAR的客户=新ServiceReference1.BANBICSoapClient(IBANBICSoap))
{
    字符串结果= client.calculateIBAN1(异国,一些账户);
}

请注意,这也将增加一个&LT; system.serviceModel方式&gt; 来你的web.config文件,你可以管理WCF客户端的端点

另外,您可以使用 svcutil.exe的来生成该服务的客户端代理,如图的 本文 MSDN上。

I'm trying to invoke methods from http://www.ibanbic.be/IBANBIC.asmx

I have read a lot of forums and tutorials, but all the information is about setting up a webservice in ASP.net or using ajax / javascript. I just need to call the function: calculateIBAN1.

A tutorial step by step would be awesome.

Thanks in advance

解决方案

A tutorial step by step would be awesome.

Right click on the References menu in your project in the solution explorer and choose Add Service Reference.... In the address type http://www.ibanbic.be/IBANBIC.asmx and click Go and then OK. This will generate a strongly typed client proxy that will allow you to invoke the service:

using (var client = new ServiceReference1.BANBICSoapClient("IBANBICSoap"))
{
    string result = client.calculateIBAN1("iso country", "some account");
}

Notice that this will also add a <system.serviceModel> to your web.config file where you could manage the WCF client endpoints.

Alternatively you could use the svcutil.exe to generate a client proxy for the service as shown in this article on MSDN.

这篇关于如何调用外部服务器/ web服务的方法呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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