To consume a SOAP service from .NET core, adding connected service from the project UI does not work.
Option 1:
Use dotnet-svcutil CLI.
Prerequisite: VS 2017, Version 15.5 or above
- Launch Developer Command Prompt VS 2017.
Go to app.csproj file and add below references:
Rebuild solution.
- Change directory to your project location from VS command prompt.
- run command: svcutil SOAP_URL?wsdl ;
example: example.com/test/testing?wsdl
This will generate reference files and output.config file in your project.
- .Net Core does not have any app.config or web.config files, but the output.config file will serve the SOAP binding.
Option 2
In case you need to refer more than one SOAP sevice,
- Create a new class library project, use .Net framework 4.5.1
.Net framework matters as i saw the reference files generated from contract
is not correct if .Net Framework is latest.
- Add service reference by right click on References.
- Refer the class library project from your .Net core project.