How do you configure SoapPath endpint for Web Connector in .net 5 startup.cs?

896 Views Asked by At

I have the following NuGet packages installed QbSync.QbXml QbSync.WebConnector QbSync.WebConnector.AspNetCore SoapCore

In netcore 2.2 I configured the endpoint with the first code sample. I installed the NuGet package SoapCore for .net 5, but I am unable to get a proper endpoint configured, second code sample.

public void Configure(IApplicationBuilder application){application.UseWebConnector(options => {options.SoapPath="/QBConnectorAsync.asmx"});

application.UseSoapEndpoint<IServiceCollection>("/QBConnectorAsync.asmx", new SoapEncoderOptions(), SoapSerializer.XmlSerializer);
1

There are 1 best solutions below

1
Tupac On

Try these steps:

1.Install Nuget packages:Install-Package SoapCore

2.There are 2 different ways of adding SoapCore to your ASP.NET Core website. If you are using ASP.NET Core 3.1 or higher with endpoint routing enabled (the default):

In Startup.cs:

public void ConfigureServices(IServiceCollection services)
{
    services.AddSoapCore();
    services.TryAddSingleton<ServiceContractImpl>();
    services.AddMvc();
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    app.UseRouting();

    app.UseEndpoints(endpoints => {
        endpoints.UseSoapEndpoint<ServiceContractImpl>("/ServicePath.asmx", new SoapEncoderOptions());
    });
    
}

Reference documentation: https://github.com/DigDes/SoapCore