We're upgrading a server application to .NET Core 6. It provides SOAP Web Services to several existing clients via .ASMX pages. .NET Core doesn't support server-side WCF anymore. gRPC, or at the very least CoreWCF, are recommended alternatives. Unfortunately, we have no control over the hundreds of deployed client applications. The alternative must be fully compatible with them, including the URL, which is hardcoded, and message formatting.
From my understanding, gRPC is a replacement for WCF, but it's unclear if it's capable of supporting SOAP over HTTP. Another alternative, CoreWCF, does support it, but it might be a significant technical investment for a stop-gap technology. It would be nice to leverage the learning curve towards more current. It's unclear whether either of the solutions is capable of servicing ASMX files.
Does gRPC support SOAP? If so, is it straightforward, or does it require a considerable amount of development effort? Finally, does either CoreWCF or gRPC support serving ASMX files? If not, is it possible to simply respond to ASMX URLs seamlessly?
CodePudding user response:
I found SoapCore, a solution that serves our needs perfectly.
https://github.com/DigDes/SoapCore
I incorrectly thought ASMX was a WCF feature, but it's just a facility provided by ASP.NET for basic server-side HTTP/SOAP. Since our application is based on ASP.NET, the ASMX URL can be accessed via MVC URL routing:
public void ConfigureServices(IServiceCollection services)
{
services.AddSoapCore();
services.TryAddSingleton<ServiceContractImpl>();
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseRouting();
// Route "ServicePath.asmx" to our service endpoint
app.UseEndpoints(endpoints => {
endpoints.UseSoapEndpoint<ServiceContractImpl>("/ServicePath.asmx", new SoapEncoderOptions(), SoapSerializer.DataContractSerializer);
});
}
While it is a stop-gap solution, it's specifically a SOAP messaging library rather than a general-purpose protocol framework. Setting it up and putting it into production requires straight-forward and simple.