我想在我的C#客户端应用程序中调用Web服务。 我希望能够动态地绑定到这个Web服务。ASP.NET Web服务的ServiceContract类
我使用下面的代码动态调用Web服务:
class Program
{
interface IInterface
static void Main(string[] args)
{
BasicHttpBinding bin = new BasicHttpBinding();
EndpointAddress endPoint = new EndpointAddress("http://api.wxbug.net/webservice-v1.asmx");
IInterface myInterface = ChannelFactory<IInterface>.CreateChannel(bin,endPoint);
}
}
我的问题是,如何我生成的ServiceContract接口为我的Web服务?有没有任何工具可以自动生成?这是因为我的目标Web服务非常复杂,有很多暴露的方法,我不想全部用手写服务契约接口。
你是指客户端的代理合同吗? – 2010-01-21 11:42:06
是...要动态地从客户端调用Web服务,它需要代理合同。 – ashwnacharya 2010-01-22 03:19:44