'Call SOAP service from .Net Core 6 without adding Service Reference

I am working on a website using .Net Core 6 and I need to communicate with a 3rd party SOAP service.

If I add a reference using a "Service Reference" it causes the solution to restore / include .Net Framework packages, I assume because the SOAP service is written in .Net Framework. References to the restored .Net Framework packages are in the ConnectedService.json file.

Can I use the SOAP service without adding it as a Service Reference, and therefore avoid the references to .Net 4 Framework packages?

An example warning is:

Package 'Microsoft.AspNet.Mvc 5.2.7' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net6.0'. This package may not be fully compatible with your project.

Edit: I found this which seems like a viable option - Web Service without adding a reference?

Unless there is a better way?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source