/express-soap

Express middleware based upon node-soap

Primary LanguageTypeScript

Build Status

express-soap

An express middleware based upon node-soap.

Installation

npm install express-soap --save

Usage

All node-soap options are valid and can be passed. See node-soap for documentation.

import {soap} from 'express-soap';

const app = express();

app.use('/soap/calculation', soap({
    services: {
        CalculatorService: {
            Calculator: {
                Add({a, b}, res) {
                    res({
                        result: a + b
                    });
                },
                Subtract({a, b}, res) {
                    res({
                        result: a - b
                    });
                }
              }
        }
    }, 
    wsdl: `...` // or xml (both options are valid)
}));

app.use('/soap/meta', soap({
    services: {
        MetaService: {
            /* ... */
        }
    }, 
    wsdl: `...` // or xml (both options are valid)
}));

Why?

The current way of how to implement a soap server in express with node-soap is really inconvenient (see). express-soap simplifies this by providing a middleware instead. Since the order of express request handlers and middlewares matters the original node-soap approach is problematic as well.