Visual Studio provides a feature to automatically generate code for interacting with SOAP web services. This is done by adding a 'Service Reference' to your .NET Core project. You can access this by right-clicking your project, selecting 'Add Service Reference', and then choosing the WCF option. You'll then input the WSDL URL, such as https://service.leads360.com/ClientService.asmx?WSDL
, which describes the service's operations. This process creates a 'channel factory' in your code, which manages the communication with the SOAP service.
This differs significantly from using Postman. Postman directly sends a raw HTTP POST request with the SOAP message. In contrast, the 'Add Service Reference' approach generates code that handles the SOAP protocol intricacies, including message formatting and communication management, through the channel factory.
For a more direct approach, similar to Postman, you can use the HttpClient
class in your .NET Core code. This allows you to construct and send a POST request with your hardcoded SOAP message, bypassing the automatically generated channel factory.