C# client how to invoke wsdl file

前端 未结 2 1357
我在风中等你
我在风中等你 2020-12-28 18:41

My customer gave me a .wsdl file to access their webservices. Using VS2008 I can create a project, but I don\'t know how to use the .wsdl file in it.

2条回答
  •  悲&欢浪女
    2020-12-28 19:07

    You don't invoke WSDL file, you add service reference from the file.

    To add reference, right click on the project, select Add Service Reference. Paste path to your wsdl file and hit Go.

    enter image description here

    If you want to use legacy Web Service client, select Add Web Reference and paste path to the wsdl file from there.

    I recommend to use WCF (Add Service Reference option).

    To use the service reference add code like this:

    var serviceClient = new ServiceReferenceName.MyClassClient();
    serviceClient.DoSomething();
    

    You also need to update config file with the server URL that you customer should provide you with:

    
      
                                                            
提交回复
热议问题