How to Create SOAP Web Service Using WSDL in ASP.NET Core (.NET 8) Jignasha Rathod February 15, 2025 8 min read IntroductionIn this tutorial we will show you how to make a SOAP service using WSDL in Visual Studio. We will be using .NET. We will be working with .NET 8. We want to teach you how to implement a SOAP service using WSDL in Visual Studio .NET Core, and .NET 8 is what we will be focusing on.SOAP is a protocol that helps exchange information in web services. WSDL is a standard that describes the web service interface.Even though REST is popular, many big banking systems still use SOAP. In fact, over 70% of enterprise-level banking systems rely on SOAP for reliable web services. This shows how important SOAP is in areas like finance and healthcare. Companies, like Salesforce, use SOAP APIs a lot.“NetSuite, a leading cloud ERP from Oracle, still offers SOAP APIs, which are capable of performing batch transactions via API, whereas such a feature is not available with its REST API.”“ClearBooks, a top accounting software provider, exclusively offers a SOAP API, stressing the protocol’s importance in secure and complex financial data transactions.”Let’s deep dive into how to consume or implement any SOAP-based API in ASP.NET Core (.NET 8).Creating a SOAP web service WSDL in Visual Studio ASP.NET Core (.NET 8) Launch Visual Studio 2026 on your machine.To use the code examples provided in this article you need to have Visual Studio 2022 installed on your system. If you do not already have a copy of Visual Studio 2022 you can download Visual Studio 2022 from the website, not Visual Studio 2026 because the code examples are meant for Visual Studio 2022 meant for Visual Studio 2022. Create a New Project.Navigate to “File” > “New” > “Project…”Choose the appropriate project template, such as “ASP.NET Core WebAPI.” Set up the Project in ASP.NET Core Web API and configure project settings, including the project name and location. Install the SoapCore package.After creating your Web API project in Visual Studio, incorporate the SoapCore NuGet package into it. Follow these steps: Navigate to the Solution Explorer window, Choose the project, right-click, and opt for “Manage NuGet Packages”.In the NuGet Package Manager window, locate the SoapCore package , then install it.You can also get the SoapCore package by using the NuGet Package Manager console. To start installing it you need to type in a command. The command you need to type is the one that starts the installation of the SoapCore package. Define the Data Contract.In the data contract, we define the characteristics of each SoapService data type, such as their types, names, and any rules or restrictions.This ensures that clients and services built with different programming languages or platforms can communicate effectively. namespace SoapService.Models { public class CustomerDataContract { [DataContract] public class Author { [DataMember] public int Id { get; set; } [DataMember] public string FirstName { get; set; } [DataMember] public string LastName { get; set; } [DataMember] public string EmailAddress { get; set; } } } } Define the Service ContractA service contract is made up of two parts. The service interface is one part. It tells us what the service does. The other part has details like how messages are formatted and how security works. We use something called the ServiceContract attribute in C# to define all of this. This ServiceContract attribute is like a label that we put on an interface or class to say that it is a service contract. The ServiceContract attribute is important because it marks the interface or class as a service contract, in C#.The ServiceContract attribute is really important because it marks the interface or the class as a ServiceContract in C#. This is how we use the ServiceContract attribute to make it clear that something is a ServiceContract. The ServiceContract attribute is what makes this work, in C#. namespace SoapService.Models { public class CustomerServiceContract { [ServiceContract] public interface ICustomerService { [OperationContract] CustomerDataContract GetCustomers(); } } } Create a service and add a method to the service with customer data. namespace SoapService.Services { public class CustomerService : ICustomerService { public CustomerDataContract GetCustomers() { return new CustomerDataContract { Id = 1, FirstName = "John", LastName = "Doe", EmailAddress = "john.doe@example.com" }; } } } Register a SOAP service in the Program.cs (.NET 8 Format) builder.Services.AddSingleton<ICustomerService, CustomerService>(); Configure the HTTP request pipeline for the SOAP endpoint in Program.cs app.UseSoapEndpoint<ICustomerService>("/CustomerService.asmx", new SoapEncoderOptions()); Complete the source code of the Program.cs using SoapCore; using SoapService.Services; using static SoapService.Models.CustomerServiceContract; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddSingleton<ICustomerService, CustomerService>(); builder.Services.AddControllers(); var app = builder.Build(); // Configure the HTTP request pipeline. app.UseSoapEndpoint<ICustomerService>("/CustomerService.asmx", new SoapEncoderOptions()); app.UseHttpsRedirection(); app.UseAuthorization(); app.MapControllers(); app.Run(); Run the SOAP service.Launch the application and visit the specified endpoint to view the generated WSDL. Consume WSDL in .NET 8Create a .NET Core (.NET 8) WEB API project, same as shown in the above step.Create client applications to consume the SOAP service. Visual Studio can help generate client code from the WSDL. Generate reference code from a WSDL file. Right-click on “Manage Connected Services.” Click on “Add a service reference.” Select “WCF Web Service“ Insert the WSDL URIClick “Go,” and you’ll receive a list of services, methods, and a Namespace. Use this Namespace to reference methods in the project. Clicking “Next” allows configuration,such as specifying the type of collections to generate. In this example, we’ll choose System.Collections.Generic.List. In the final configuration screen,Choose between public/private classes and opt for synchronous or default asynchronous method generation. Click “Finish” to initiate scaffolding, and your classes will be generated. Once the process is complete,Find the connected service in the Solution Explorer, containing the generated reference with configured endpoints and methods.Choosing a synchronous method generates various available methods. Create a new controller.To illustrate how to utilize the recently established connected service using the SOAP Client.To communicate with the connected service, create a client by referencing the Customer Reference. Indicate the endpoint to be used in the client. [ApiController] [Route("CustomerController")] public class CustomerController : Controller { [HttpGet] public async Task<CustomerDataContract> GetCustomersAsync() { ICustomerService customerService = new CustomerServiceClient(CustomerServiceClient.EndpointConfiguration.BasicHttpBinding_ICustomerService); return await customerService.GetCustomersAsync(); } } Execute the project and perform testing in Swagger. ConclusionUsing Visual Studio to make a SOAP service with WSDL is really easy. It helps you make web services that work well with systems and follow standards.If you follow these steps you can make a SOAP service. Define what it does. Then you can easily add it to your projects.Just keep in mind that you need to adjust these steps to fit your project and the version of Visual Studio you have. You should use SOAP service when you need to make a SOAP service and WSDL is good, for defining what your SOAP service does.Stay with us for more tips and tricks about the ASP.NET Core (.NET 8)Development concept.I hope you will like my blog to help provide a firm foundation for building interoperable and standardized web services.You can share this blog via a social button to help other ASP.NET Developers. As we are at Satva Solutions, we provide API integration services for any ASP.NET MVC/Core application.Happy coding!Next, read this: How to Enable Theme Customization Dynamically in ASP.NET MVC? How to Generate PDF using Asp.Net Core and Azure Top 5 Open Source Content management systems using ( Asp.net core MVC ) How to Add Full Calendar in ASP.NET MVC Application? Job Scheduling in ASP.NET MVC Website using Quartz SchedulerFAQsWhat is WSDL in C#?WSDL (Web Services Description Language) defines the structure of a SOAP web service, including operations, inputs, outputs, and endpoints used in C# applications.How do you call a SOAP web service in C#?You can call a SOAP web service in C# by adding a service reference in Visual Studio or using HttpClient to send XML-based SOAP requests.Does ASP.NET Core support SOAP services?ASP.NET Core does not natively support SOAP like WCF, but SOAP services can be implemented using libraries like CoreWCF or SoapCore.Does .NET 8 support SOAP web services?Yes, .NET 8 supports SOAP web services through external libraries such as SoapCore and CoreWCF for building and consuming SOAP APIs.How do I generate a client proxy from a WSDL in .NET 8?You can generate a SOAP client proxy in .NET 8 using Visual Studio Connected Services or the dotnet-svcutil CLI tool.What is the difference between SOAP and REST?SOAP is a protocol-based API standard that uses XML and WSDL, while REST is an architectural style that commonly uses JSON and HTTP methods.When should you use SOAP instead of REST?SOAP is preferred in enterprise applications that require strict security, formal contracts, and reliable transaction handling.How do I secure a SOAP service in ASP.NET Core?To secure a SOAP service in ASP.NET Core, enforce HTTPS, implement authentication and authorization, and follow standard API security practices.