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.
A Web reference enables a project to consume one or more XML Web services. Use the Add Web Reference Dialog Box to search for Web services locally, on a local area network, or on the Internet.
After adding a Web reference to your current project, you can call any methods exposed by the Web service.
To add a Web Reference
In the URL box of the Add Web Reference dialog box, type the URL to obtain the service description of the Excel Web Services, such as http:////_vti_bin/excelservice.asmx or http:///_vti_bin/excelservice.asmx. Then click Go to retrieve information about the Web service. Note Note:
You can also open the Add Web Reference dialog box in the Solution Explorer pane by right-clicking References and selecting Add Web Reference.
Read
How to: Add and Remove Web References
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
.
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:
<client>
<endpoint address="http://UrlFromYourCustomerHere"
binding="basicHttpBinding"
bindingConfiguration="xxx"
contract="MyServiceReference.xxx"
name="xxx/>
</client>