How To Use WSDL File To Consume WCF Service in .NET Core Application?
WCF Services play a pivotal role in modern day distributed application as all the requests from the UI Layer is passed on to the WCF Service API's which serve those requests appropriately. Lets see how we can consume the WCF Service by a .NET Core WPF application.
What is WSDL File?
How to Download WSDL File?
WSDL file can be downloaded by going to the URL location where the WCF Service is hosted,
For example:
I have hosted the WCF Service locally identified by URL: http://localhost:6875/process
How to Configure Service Reference with the help of WSDL File?
Steps:
Step 1 : enter this URL in a Web browser as shown below
Accessing WCF Service through Web browser |
Step 2: Click on the link as highlighted in the below image
Accessing the WSDL Content through the URL |
Step 3: When you click on the link mentioned above you can see the WSDL content in the XML Format as shown below. Save the XML content with the extension .wsdl. Note you can give any name for the file.
WSDL File Content |
WSDL File |
Step 4: Add this WSDL file to the .NET Core WPF Application by right clicking the project and navigate to Add Service Reference as shown below:
Adding Service Reference |
Step 5: Add Service Reference Page opens up. Click on the Microsoft WCF Web Service Reference Provider, corresponding dialog opens up then click on Browse and add the wsdl file which is being generated in the previous step.
Adding WSDL File as Service Reference |
Step 6: Click on Next and Finish the Process of Adding the service Reference. For me while adding the service reference I got an error related to .NET Core Runtime 2.1 is missing, So if you get the same error please install .NET Core Runtime appropriate version will be mentioned in the error message. This can be installed from Microsoft Site or from Visual Studio Installer page as shown below:
Installing .NET Core 2.1 Runtime |
Step 7: Once the addition of Service Reference is successful you will see configured against the Microsoft WCF Web Service Reference Provider as shown below:
Service Reference Provider Configured |
Thanks for Reading. Do Share your valuable feedback in the comments below.
Comments
Post a Comment