All Projects → DigDes → Soapcore

DigDes / Soapcore

Licence: mit
SOAP extension for ASP.NET Core

Projects that are alternatives of or similar to Soapcore

Product Ei
An open source, a high-performance hybrid integration platform that allows developers quick integration with any application, data, or system.
Stars: ✭ 277 (-53.05%)
Mutual labels:  soap, middleware
Cors
Node.js CORS middleware
Stars: ✭ 5,252 (+790.17%)
Mutual labels:  middleware
Cdap
An open source framework for building data analytic applications.
Stars: ✭ 509 (-13.73%)
Mutual labels:  middleware
Redux Ecosystem Links
A categorized list of Redux-related addons, libraries, and utilities
Stars: ✭ 5,076 (+760.34%)
Mutual labels:  middleware
Body Parser
Node.js body parsing middleware
Stars: ✭ 4,962 (+741.02%)
Mutual labels:  middleware
Redux Saga
An alternative side effect model for Redux apps
Stars: ✭ 21,975 (+3624.58%)
Mutual labels:  middleware
Zerocode
A community-developed, free, open source, microservices API automation and load testing framework built using JUnit core runners for Http REST, SOAP, Security, Database, Kafka and much more. Zerocode Open Source enables you to create, change, orchestrate and maintain your automated test cases declaratively with absolute ease.
Stars: ✭ 482 (-18.31%)
Mutual labels:  soap
Netdiscovery
NetDiscovery 是一款基于 Vert.x、RxJava 2 等框架实现的通用爬虫框架/中间件。
Stars: ✭ 573 (-2.88%)
Mutual labels:  middleware
Gin Boilerplate
The fastest way to deploy a restful api's with Gin Framework with a structured project that defaults to PostgreSQL database and JWT authentication middleware stored in Redis
Stars: ✭ 559 (-5.25%)
Mutual labels:  middleware
Servicestack
Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all
Stars: ✭ 4,976 (+743.39%)
Mutual labels:  soap
Gear
A lightweight, composable and high performance web service framework for Go.
Stars: ✭ 544 (-7.8%)
Mutual labels:  middleware
Soap Client
A general purpose SOAP client for PHP
Stars: ✭ 523 (-11.36%)
Mutual labels:  middleware
Underconstruction
This Laravel 8 package makes it possible for you to set your website in "Under Construction" mode. Only users with the correct 4 (or more) digit code can access your site. 🔥 💥 🔥
Stars: ✭ 549 (-6.95%)
Mutual labels:  middleware
Repatch
Dispatch reducers
Stars: ✭ 516 (-12.54%)
Mutual labels:  middleware
Laravel Soap
A soap client wrapper for Laravel
Stars: ✭ 559 (-5.25%)
Mutual labels:  soap
Mortar
Mortar is a GO framework/library for building gRPC (and REST) web services.
Stars: ✭ 492 (-16.61%)
Mutual labels:  middleware
Swagger Express Middleware
Swagger 2.0 middlware and mocks for Express.js
Stars: ✭ 543 (-7.97%)
Mutual labels:  middleware
Kraken Js
An express-based Node.js web application bootstrapping module.
Stars: ✭ 4,938 (+736.95%)
Mutual labels:  middleware
Serve Favicon
favicon serving middleware
Stars: ✭ 586 (-0.68%)
Mutual labels:  middleware
Alosaur
Alosaur - Deno web framework with many decorators
Stars: ✭ 559 (-5.25%)
Mutual labels:  middleware

SoapCore

NuGet Version

SOAP protocol middleware for ASP.NET Core

Based on Microsoft article: Custom ASP.NET Core Middleware Example.

Support ref\out params, exceptions. Works with legacy SOAP\WCF-clients.

Getting Started

Requirements

The following frameworks are supported:

  • .NET Core 3.1 (using ASP.NET Core 3.0)
  • .NET Core 3.0 (using ASP.NET Core 3.0)
  • .NET Core 2.1 (using ASP.NET Core 2.1)
  • .NET Standard 2.0 (using ASP.NET Core 2.1)

.NET Core 2.2 / ASP.NET Core 2.2 is not explictly supported, but will probably work. We suggest upgrading to .NET Core 3.0 since .NET Core 2.2 is only supported until December 23, 2019. If you are using .NET Framework, and you cannot migrate to .NET Core, we recommend downgrading to ASP.net Core 2.1 since it's an LTS release and will be supported for some time.

Installing

PM> Install-Package SoapCore

There are 2 different ways of adding SoapCore to your ASP.net Core website. If you are using ASP.NET Core 3.0 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 BasicHttpBinding());
	});
    
}

If you are using ASP.NET Core 2.1 (i.e., on .NET Framework, .NET Core 2.1, or another .NET Standard 2.0 compliant platform):

public void ConfigureServices(IServiceCollection services)
{
    services.AddSoapCore();
    services.TryAddSingleton<ServiceContractImpl>();
    services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    app.UseSoapEndpoint<ServiceContractImpl>("/ServicePath.asmx", new BasicHttpBinding());
}

Program.cs

public static void Main(string[] args)
{
    var host = new WebHostBuilder()
        .UseKestrel()
        .UseUrls("http://*:5050")
        .UseStartup<Startup>()
        .Build();
    host.Run();
}

Using with legacy WCF/WS

It is possible to use SoapCore with .net legacy WCF and Web Services, both as client and service.

Primary point here is to use XmlSerializer and properly markup messages and operations with xml serialization attributes. You may use legacy pre-generated wrappers to obtain these contracts or implement them manually. Extended example is available under serialization tests project.

Using with external WSDL / XSD schemas

There is an optional feature included where you can instead of generating service description from code get the service description from files stored on the server.

To use it, add a setting like this to appsettings

 "FileWSDL": {
    "UrlOverride": "",
    "WebServiceWSDLMapping": {
      "Service.asmx": {
        "WsdlFile": "snapshotpull.wsdl",
        "SchemaFolder": "Schemas",
        "WsdlFolder": "Schemas"
      }
    },
    "VirtualPath": ""
  • UrlOverride - can be used to override the URL in the service description. This can be useful if you are behind a firewall.
  • Service.asmx - is the endpoint of the service you expose. You can have more than one.
  • WsdlFile - is the name of the WSDL on disc.
  • SchemaFolder - if you import XSD from WSDL, this is the folder where the Schemas are stored on disc.
  • WsdlFolder - is the folder that the WSDL file is stored on disc.
  • VirualPath - can be used if you like to add a path between the base URL and service.

To read the setting you can do the following

In Startup.cs:

var settings = Configuration.GetSection("FileWSDL").Get<WsdlFileOptions>();
settings.AppPath = env.ContentRootPath; // The hosting environment root path
...

app.UseSoapEndpoint<ServiceContractImpl>("/Service.asmx", new BasicHttpBinding(), SoapSerializer.XmlSerializer, false, null, settings);

If the WsdFileOptions parameter is supplied then this feature is enabled / used.

References

Tips and Tricks

Extending the pipeline

In your ConfigureServices method, you can register some additional items to extend the pipeline:

  • services.AddSoapMessageInspector() - add a custom MessageInspector. This function is similar to the IDispatchMessageInspector in WCF. The newer IMessageInspector2 interface allows you to register multiple inspectors, and to know which service was being called.
  • services.AddSingleton() - add a custom OperationInvoker. Similar to WCF's IOperationInvoker this allows you to override the invoking of a service operation, commonly to add custom logging or exception handling logic around it.

How to get custom HTTP header in SoapCore service

Use interface IServiceOperationTuner to tune each operation call.

Create class that implements IServiceOperationTuner. Parameters in Tune method:

  • httpContext - current HttpContext. Can be used to get http headers or body.
  • serviceInstance - instance of your service.
  • operation - information about called operation.
public class MyServiceOperationTuner : IServiceOperationTuner
{
    public void Tune(HttpContext httpContext, object serviceInstance, SoapCore.ServiceModel.OperationDescription operation)
    {
        if (operation.Name.Equals("SomeOperationName"))
        {
            MyService service = serviceInstance as MyService;
            string result = string.Empty;

            StringValues paramValue;
            if (httpContext.Request.Headers.TryGetValue("some_parameter", out paramValue))
            {
                result = paramValue[0];
            }

            service.SetParameterForSomeOperation(result);
        }
    }
}

Register MyServiceOperationTuner in Startup class:

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        // ...
        services.AddSoapServiceOperationTuner(new MyServiceOperationTuner());
        //...
    }
    // ...
}

Change your service to get the possibility to store information from http headers:

public class MyService : IMyServiceService
{
    // Use ThreadLocal or some of thread synchronization stuff if service registered as singleton.
    private ThreadLocal<string> _paramValue = new ThreadLocal<string>() { Value = string.Empty };

    // ...
    
    public void SetParameterForSomeOperation(string paramValue)
    {
        _paramValue.Value = paramValue;
    }

    public string SomeOperationName()
    {
        return "Param value from http header: " + _paramValue.Value;
    }
}

Contributing

See Contributing guide

Contributors

Made with contributors-img.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].