How to Create SOAP Web Service Using WSDL in ASP.NET Core (.NET 8)

Introduction

In this tutorial, we will guide you through the process of implementing a SOAP (Simple Object Access Protocol) service using WSDL (Web Services Description Language) in Visual Studio .NET Core(.NET 8).

SOAP is a widely used protocol for exchanging structured information in web services, and WSDL serves as a standard for describing the web service interface.

Despite the rise of REST, over 70% of enterprise-level banking systems still rely on SOAP for secure, reliable web services, showcasing its key role in sectors like finance and healthcare, with giants like Salesforce extensively using SOAP APIs.

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).

How to Create SOAP Web Service Using WSDL in Visual Studio .NET Core

Creating a SOAP web service WSDL in Visual Studio ASP.NET Core (.NET 8)

    1. Launch Visual Studio 2026 on your machine.

      To use the code examples provided in this article, you should have Visual Studio 2022 installed on your system. If you don’t already have a copy, you can download Visual Studio 2026 here.

      Visual Studio 2026 Dashboard
    2. Create a New Project.

      Navigate to “File” > “New” > “Project…”

      Choose the appropriate project template, such as “ASP.NET Core WebAPI.”

      Create new project ASP.NET Core WebAPI
    3. Set up the Project in ASP.NET Core Web API and configure project settings, including the project name and location.

      Visual Studio 2026 configure new ASP.NET Core Web API project screen with project name field highlighted
    4. 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 also have the option to install the SoapCore package using the NuGet Package Manager console. Simply input the following command line to initiate the installation process.
    5. 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; }
              }
          }
      }
      
    6. Define the Service Contract

      A service contract has two parts: the service interface, which describes the service, and additional details such as message formats and security, all defined using the ServiceContract attribute in C#. This attribute marks an interface or class as a service contract.

      
      namespace SoapService.Models
      {
          public class CustomerServiceContract
          {
              [ServiceContract]
              public interface ICustomerService
              {
                  [OperationContract]
                  CustomerDataContract GetCustomers();
              }
          }
      }
        
    7. 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"
                  };
              }
          }
      }
      
    8. Register a SOAP service in the Program.cs (.NET 8 Format)

      
        builder.Services.AddSingleton<ICustomerService, CustomerService>();
      
    9. Configure the HTTP request pipeline for the SOAP endpoint in Program.cs

      
      app.UseSoapEndpoint<ICustomerService>("/CustomerService.asmx", new SoapEncoderOptions());
      
    10. 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();
      
      
    11. Run the SOAP service.

      Launch the application and visit the specified endpoint to view the generated WSDL.

ASP.NET SOAP web service XML response displayed in browser at localhost showing WSDL definitions
SOAP GetCustomers request and response XML shown in SoapUI for ASP.NET ASMX web service

Consume WSDL in .NET 8

Create 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.

  1. Generate reference code from a WSDL file. Right click on “Manage Connected Services”

    Visual Studio Manage Connected Services option in ASP.NET Core project to add SOAP service reference
  2. Click on “Add a service reference.”

    Screenshot of a software interface displaying "Connected Services" with options for adding a service dependency or reference, featuring a highlighted "Add a service reference" link for integrating SOAP web services.
  3. Select “WCF Web Service“

    Select WCF Web Service option in Visual Studio to add SOAP service reference in ASP.NET Core
  4. Insert the WSDL URI

    Click “Go,” and you’ll receive a list of services, methods, and a Namespace. Use this Namespace to reference methods in the project.

    Enter WSDL URL and select GetCustomers operation while adding WCF service reference in Visual Studio
  5. Clicking “Next” allows configuration,

    such as specifying the type of collections to generate. In this example, we’ll choose System.Collections.Generic.List.

    WCF service reference data type options in Visual Studio with reuse types in referenced assemblies selected
  6. In the final configuration screen,

    Choose between public/private classes and opt for synchronous or default asynchronous method generation.

    Generate synchronous operations option while adding WCF SOAP service reference in Visual Studio
  7. Click “Finish” to initiate scaffolding, and your classes will be generated.

    WCF SOAP service reference successfully added in Visual Studio showing configuration progress complete
  1. 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.

    Screenshot of code in an IDE showing highlighted sections for the methods GetCustomers() and GetCustomersAsync() in CustomerDataContract and ICustomerService files, illustrating their integration with a SOAP web service.
  2. 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();
        }
    }
    

  3. Execute the project and perform testing in Swagger.

    Swagger UI testing ASP.NET Core API endpoint consuming WCF SOAP service with JSON response

Conclusion

Implementing a SOAP service using WSDL in Visual Studio is straightforward and provides a firm foundation for building interoperable, standardized web services.

By using these steps, you can create a SOAP service, define its contract, and seamlessly integrate it into your applications.

Remember to adapt the instructions based on your specific project requirements and the version of Visual Studio you are using.

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:

FAQs

Does .NET 8 support SOAP web services?
Yes, .NET 8 supports SOAP web services using external libraries like SoapCore or CoreWCF.
What is the difference between SoapCore and CoreWCF?
SoapCore is a lightweight library for creating SOAP services in ASP.NET Core, while CoreWCF is designed for migrating full WCF applications to modern .NET versions.
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.
Can Swagger test SOAP services?
No, Swagger cannot test SOAP services because it is designed for REST APIs using OpenAPI specifications.
Is SOAP still relevant in 2026?
Yes, SOAP remains relevant in 2026 for enterprise and legacy system integrations.
How do I secure a SOAP service in ASP.NET Core?
To secure a SOAP service in ASP.NET Core, enforce HTTPS and implement authentication middleware.
What is WSDL in SOAP?
WSDL (Web Services Description Language) is an XML document that defines the structure and operations of a SOAP web service.
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.
What systems can integrate with SAP Business One?
Almost any modern platform Shopify, Salesforce, QuickBooks, Power BI, and more can be integrated via APIs or middleware.
How long does integration take?
Simple setups may take 2–3 weeks; complex multi-system integrations 4–8 weeks, depending on scope.
Is integration secure?
Yes. Satva Solutions uses encrypted APIs (HTTPS and OAuth 2.0) and adheres to SAP security guidelines..
Can SAP Business One be integrated with custom in-house software?
Absolutely. Our team builds bespoke connectors to align SAP B1 with proprietary systems.



Article by

Jignasha Rathod

Jignasha Rathod is a Technical Analyst with over a decade of experience in the IT industry. She excels in .NET, CI/CD, GitHub, Azure. and has a proven track record in project management, leadership, API integrations, and Azure AI and ML.net . Jignasha is focused on performance enhancement and possesses deep domain expertise in open source CMS ( umbraco, orchard cms ) accounting, CRM, ERP (SAP, NetSuite, Business Central) and e-commerce. Her extensive experience spans across both B2B and B2C e-commerce platforms, and she is leveraging AI and ML technologies to drive innovation and efficiency in client projects.