Skip to content

RishikeshDarandale/soap-server-lambda

Repository files navigation

soap-server-lambda

CircleCI Known Vulnerabilities Codacy Badge Codacy Badge Dependabot Status npm npm NpmLicense

This is AWS lambda integration for a simple SOAP server.

A little bit background

There are still a lot of old/legacy project which use SOAP protocol to expose their services. To grab the benefit of AWS serverless services, this is simple try to achieve this step. This project is still matuaring to support all kind of requirements from SOAP world. I will be greatful to all if you want to report an issue or want to contribute in terms of pull request.

Install

$npm install --save soap-server-lambda

OR

$yarn add soap-server-lambda

Usage

Define a service as below and you can use your WSDL with this service

'use strict';

/**
 * Sample MyService
 */
class MyService {
  /**
   * Test function method
   *
   * @param {String} testParam
   */
  async MyFunction(testParam) {
    if (testParam) {
      return {
        status: 'Successful with param: ' + testParam,
      };
    }
    return {
      status: 'Unsuccessful',
    };
  }
}

module.exports = MyService;

Create a lambda handler as below

const SoapServer = require('soap-server-lambda');

const MyService = require('/path/to/MyService');

const server = new SoapServer({
  services: () => {
    return {
      myService: {
        wsdlPath: 'wsdls/MyService.wsdl',
        service: new MyService(),
      },
    };
  },
});

exports.handler = server.createHandler({debug: true});

You have define the name of your function as same to operation name mentioned in your service WSDL file.

Inspiration and reference

This project took a lot of inspiration and reference from apollo-server-lambda project.

Issue or need a new feature?

If you are experiencing a issue or wanted to add a new feature, please create a github issue here.

Contributing

⭐ Star me on GitHub — it helps!

❤️ contribution: Here is contributing guide in deatil.

For impatient here are quick steps:

  • Fork the repository
  • Create Branch in you local repository
  • while(youFinish) { Commit }
  • Squash related commits.
  • Write unit test cases for your work.
  • Check the Build on your local.
  • Raise a Pull Request (aka PR)