Search code examples
c#wcf.net-coresoap.net-4.8

error: PlatformNotSupportedException: Configuration files are not supported or How .NET Core 6 consume SOAP .NET Framework wcf


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


Solution

  • 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:

    1. Check if you installed .NET Core 2.1; if not, download from Microsoft and install.

    2. Open Visual Studio 2019 or Visual Studio 2022.

      • Create a .NET Core Console App.
      • Go to View, then click Terminal.
      • At the terminal, input:
        dotnet new tool-manifest
        
    3. At the Terminal, input:

      dotnet tool install dotnet-svcutil
      
    4. 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:

    1. At Terminal input: --sync

      dotnet dotnet-svcutil https://www.dataaccess.com/webservicesserver/TextCasing.wso --sync
      

      More information

      or

      Input the other WSDL link:

      dotnet dotnet-svcutil <wsdl url>
      
    2. 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);
      }