I have Dot Net Framework 3.5 Web Service: http://www.dneonline.com/calculator.asmx I want to consume it on dot Net Core (3 or 6, any version).
When I run the program, it throws exception: PlatformNotSupportedException: Configuration files are not supported
Is it technically possible or not to call WCF Dot Net Framework 3.5 from any Dot Net Core application?
Reference: https://medium.com/compendium/integrating-with-soap-web-services-in-net-core-adebfad173fb https://howtodomssqlcsharpexcelaccess.blogspot.com/2019/06/mvc-consume-web-service-service.html
My mentor gave me an article that provided the answer. Mister Khalidabuhakmeh does a great job explaining how to consume SOAP APIs in .NET Core; thank you!
To summarize their steps:
Check if you installed .NET Core 2.1; if not, download from Microsoft and install.
Open Visual Studio 2019 or Visual Studio 2022.
dotnet new tool-manifest
At the Terminal, input:
dotnet tool install dotnet-svcutil
At the Terminal, input:
dotnet dotnet-svcutil https://www.dataaccess.com/webservicesserver/TextCasing.wso
If you have synchronous operations and you do have synchronous operations, then:
At Terminal input: --sync
dotnet dotnet-svcutil https://www.dataaccess.com/webservicesserver/TextCasing.wso --sync
or
Input the other WSDL link:
dotnet dotnet-svcutil <wsdl url>
Consume SOAP:
static async Task Main(string[] args)
{
var client = new TextCasingSoapTypeClient(
TextCasingSoapTypeClient.EndpointConfiguration.TextCasingSoap,
"https://www.dataaccess.com/webservicesserver/TextCasing.wso");
var result =
await client.AllLowercaseWithTokenAsync("THIS IS A STRING", "");
// result: this is a string
var value = result.Body.AllLowercaseWithTokenResult;
Console.WriteLine(value);
}