/fastify-soap-client

Fastify plugin for a SOAP client

Primary LanguageJavaScriptMIT LicenseMIT

fastify-soap-client

Build Status js-standard-style

This plugin decorates your fastify instance with a SOAP client using soap library

Install

npm i --save fastify-soap-client

Usage

const fastifySoapClient = require('fastify-soap-client')

fastify.register(fastifySoapClient, {
  url: 'http://www.dneonline.com/calculator.asmx?WSDL',
  // options: { soap library options }
})

const addSchema = {
  body: {
    type: 'array',
    items: [
      { type: 'number' },
      { type: 'number' }
    ]
  }
}
fastify.post('/add', addSchema, function (req, reply) {
  this.soapClient.Add({ intA: req.body[0], intB: req.body[1] }, function (err, result) {
    if (err) {
      reply.send(err)
      return
    }
    reply.send(result.AddResult)
  })
})

Reference

License

Licensed under MIT