Home › Blog › How to Create SOAP Web Service Using WSDL in ASP.NET Core (.NET 8)How to Create SOAP Web Service Using WSDL in ASP.NET Core (.NET 8) Jignasha Rathod February 15, 2025 8 min read IntroductionSOAP still powers critical integrations at Salesforce, SAP, Oracle NetSuite, and most banks. REST is faster to build and easier to debug. But when the other end of the wire belongs to a financial institution or enterprise ERP, SOAP’s WSDL contract and WS-Security are often non-negotiable.This tutorial shows how to build a SOAP service in ASP.NET Core using SoapCore. Code examples target .NET 8 LTS and work unchanged in .NET 9.Even though REST dominates most modern public APIs, SOAP remains the standard for high-security enterprise integrations. Financial institutions, healthcare platforms, and ERP vendors like SAP, Oracle NetSuite, and Salesforce continue to ship SOAP APIs for workflows that require formal contracts and strict message validation.“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.”The sections below walk through building and consuming a SOAP service step by step.Creating a SOAP web service WSDL in Visual Studio ASP.NET Core (.NET 8) Launch Visual Studio 2022 on your machine.To follow the code examples in this article you need Visual Studio 2022. Download it from the Microsoft website if you do not already have it. 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. ConclusionThe pattern itself is not complicated: data contract, service interface, implementation class, endpoint in Program.cs. A few minutes of setup and you have a working WSDL.Production use cases follow the same model. Banks use SOAP because the strict contract gives them message-level auditability – REST over JSON does not enforce that at the protocol layer. SAP and Oracle ship SOAP APIs for similar reasons: WSDL guarantees type safety across language boundaries. Healthcare is a special case because HL7 is XML-native by spec, so SOAP fits without adding a translation layer.Once the service is running, add WS-Security for message-level encryption, put the WSDL behind an API gateway, and write integration tests against a test host using the generated proxy class.Satva Solutions provides ASP.NET Core API integration services for teams on .NET 8 and .NET 9. If your project needs SOAP alongside REST or event-driven components, get in touch.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.{ “@context”: “https://schema.org”, “@type”: “FAQPage”, “mainEntity”: [ { “@type”: “Question”, “name”: “What is WSDL in C#?”, “acceptedAnswer”: { “@type”: “Answer”, “text”: “WSDL (Web Services Description Language) defines the structure of a SOAP web service, including operations, inputs, outputs, and endpoints used in C# applications.” } }, { “@type”: “Question”, “name”: “How do you call a SOAP web service in C#?”, “acceptedAnswer”: { “@type”: “Answer”, “text”: “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.” } }, { “@type”: “Question”, “name”: “Does ASP.NET Core support SOAP services?”, “acceptedAnswer”: { “@type”: “Answer”, “text”: “ASP.NET Core does not natively support SOAP like WCF, but SOAP services can be implemented using libraries like CoreWCF or SoapCore.” } }, { “@type”: “Question”, “name”: “Does .NET 8 support SOAP web services?”, “acceptedAnswer”: { “@type”: “Answer”, “text”: “Yes, .NET 8 supports SOAP web services through external libraries such as SoapCore and CoreWCF for building and consuming SOAP APIs.” } }, { “@type”: “Question”, “name”: “How do I generate a client proxy from a WSDL in .NET 8?”, “acceptedAnswer”: { “@type”: “Answer”, “text”: “You can generate a SOAP client proxy in .NET 8 using Visual Studio Connected Services or the dotnet-svcutil CLI tool.” } }, { “@type”: “Question”, “name”: “What is the difference between SOAP and REST?”, “acceptedAnswer”: { “@type”: “Answer”, “text”: “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.” } }, { “@type”: “Question”, “name”: “When should you use SOAP instead of REST?”, “acceptedAnswer”: { “@type”: “Answer”, “text”: “SOAP is preferred in enterprise applications that require strict security, formal contracts, and reliable transaction handling.” } }, { “@type”: “Question”, “name”: “How do I secure a SOAP service in ASP.NET Core?”, “acceptedAnswer”: { “@type”: “Answer”, “text”: “To secure a SOAP service in ASP.NET Core, enforce HTTPS, implement authentication and authorization, and follow standard API security practices.” } } ] }{ “@context”: “https://schema.org”, “@type”: “TechArticle”, “@id”: “https://satvasolutions.com/blog/create-soap-web-service-wsdl-aspnet-core#techarticle”, “mainEntityOfPage”: { “@type”: “WebPage”, “@id”: “https://satvasolutions.com/blog/create-soap-web-service-wsdl-aspnet-core” }, “headline”: “How to Create SOAP Web Service Using WSDL in ASP.NET Core (.NET 8)”, “description”: “Step-by-step tutorial to create a SOAP web service using WSDL in ASP.NET Core (.NET 8) with SoapCore in Visual Studio 2022, expose the WSDL endpoint, and generate a .NET client proxy to consume the service.”, “image”: [ “https://satvasolutions.com/wp-content/uploads/2024/02/How-to-Create-SOAP-Web-Service-Using-WSDL-in-Visual-Studio-.NET-Core-1.png” ], “author”: { “@type”: “Person”, “name”: “Jignasha Rathod” }, “publisher”: { “@type”: “Organization”, “name”: “Satva Solutions”, “url”: “https://satvasolutions.com/” }, “datePublished”: “2025-02-15”, “dateModified”: “2026-06-10”, “inLanguage”: “en”, “isAccessibleForFree”: true, “keywords”: [ “SOAP”, “WSDL”, “ASP.NET Core”, “.NET 8”, “.NET 9”, “Visual Studio 2022”, “SoapCore”, “SOAP API”, “WCF client”, “Connected Services” ], “articleSection”: [ “ASP.NET Core Development”, “API Integration” ] }{ “@context”: “https://schema.org”, “@type”: “HowTo”, “@id”: “https://satvasolutions.com/blog/create-soap-web-service-wsdl-aspnet-core#howto”, “name”: “How to Create and Consume a SOAP Web Service (WSDL) in ASP.NET Core (.NET 8)”, “description”: “Step-by-step guide to build a SOAP web service using WSDL in ASP.NET Core (.NET 8) with SoapCore in Visual Studio 2022 and generate a client proxy to consume it.”, “image”: “https://satvasolutions.com/wp-content/uploads/2024/02/How-to-Create-SOAP-Web-Service-Using-WSDL-in-Visual-Studio-.NET-Core-1.png”, “totalTime”: “PT30M”, “estimatedCost”: { “@type”: “MonetaryAmount”, “currency”: “USD”, “value”: “0” }, “tool”: [ { “@type”: “HowToTool”, “name”: “Visual Studio 2022” }, { “@type”: “HowToTool”, “name”: “.NET 8 SDK” } ], “supply”: [ { “@type”: “HowToSupply”, “name”: “SoapCore NuGet Package” } ], “step”: [ { “@type”: “HowToStep”, “position”: 1, “name”: “Create a new ASP.NET Core Web API project”, “text”: “Open Visual Studio 2022, create a new ASP.NET Core Web API project, and select .NET 8 (LTS) as the target framework.” }, { “@type”: “HowToStep”, “position”: 2, “name”: “Install SoapCore”, “text”: “Install the SoapCore package using NuGet Package Manager or the dotnet CLI to enable SOAP support in ASP.NET Core.” }, { “@type”: “HowToStep”, “position”: 3, “name”: “Define Data Contracts”, “text”: “Create request and response models using DataContract and DataMember attributes to define SOAP message structures.” }, { “@type”: “HowToStep”, “position”: 4, “name”: “Define the Service Contract”, “text”: “Create an interface marked with ServiceContract and define operations using OperationContract attributes.” }, { “@type”: “HowToStep”, “position”: 5, “name”: “Implement the SOAP Service”, “text”: “Create a class implementing the service contract and provide the required business logic.” }, { “@type”: “HowToStep”, “position”: 6, “name”: “Configure SOAP Endpoint in Program.cs”, “text”: “Register the service in the dependency injection container and configure UseSoapEndpoint in the .NET 8 minimal hosting model.” }, { “@type”: “HowToStep”, “position”: 7, “name”: “Run and Verify WSDL”, “text”: “Run the application and access the service endpoint with ?wsdl to verify that the WSDL is generated successfully.” }, { “@type”: “HowToStep”, “position”: 8, “name”: “Generate Client Proxy from WSDL”, “text”: “Use Visual Studio 2022 Connected Services or dotnet-svcutil to generate strongly-typed client proxy classes from the WSDL.” }, { “@type”: “HowToStep”, “position”: 9, “name”: “Consume SOAP Service”, “text”: “Use the generated proxy inside a controller or service class to call SOAP operations and retrieve data.” } ] }{ “@context”: “https://schema.org”, “@type”: “BreadcrumbList”, “@id”: “https://satvasolutions.com/blog/create-soap-web-service-wsdl-aspnet-core#breadcrumb”, “itemListElement”: [ { “@type”: “ListItem”, “position”: 1, “name”: “Home”, “item”: “https://satvasolutions.com/” }, { “@type”: “ListItem”, “position”: 2, “name”: “Blog”, “item”: “https://satvasolutions.com/blog/” }, { “@type”: “ListItem”, “position”: 3, “name”: “How to Create SOAP Web Service Using WSDL in ASP.NET Core”, “item”: “https://satvasolutions.com/blog/create-soap-web-service-wsdl-aspnet-core” } ] }