This plugin decorates your fastify instance with a SOAP client using soap
library
npm i --save fastify-soap-client
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)
})
})
- url: (required) the url where the wsdl is located. See soap library reference
- options: the soap library options. See soap library
Licensed under MIT