SOAP adapter for Integreat
Adapter that lets Integreat use a SOAP service.
Getting started
Prerequisits
Requires node v8.6 and Integreat v0.7.
Installing and using
Install from npm:
npm install integreat-adapter-soap
Example of use:
const integreat = require('integreat')
const soapAdapter = require('integreat-adapter-soap')
const defs = require('./config')
const resources = integreat.mergeResources(
integreat.resources(),
{ adapters: { soap: soapAdapter() } }
)
const great = integreat(defs, resources)
// ... and then dispatch actions as usual
Example source configuration:
{
id: 'store',
adapter: 'soap',
auth: 'soapAuth',
options: {
baseUri: 'https://api.soapheaven.com',
soap: { version: '1.1', xsiPrefix: 'i' }
},
endpoints: [
{ options: { uri: '/getDocuments' } }
]
}
The soapAuth
referenced here should be a valid auth object, relevant for this
SOAP service.
An optional logger may be provided to the soapAdapter()
function, to log out
the request sent to the service, and its response. The logger must be an object
with an info()
and an error()
function. Both should accept a string message
as first argument, and a meta object as the second.
You may also override the SOAPAction
by setting another namespace for it with
soapActionNamespace
or by replacing it entirely with soapAction
. Both should
be set on the options
object.
Set xsiPrefix
on options.soap
to override the default xsi namespace (the
default is xsi
).
Available endpoint options:
-
uri
: The uri to send requests to for this endpoint. -
baseUri
: An option base uri prepended touri
. -
soap.version
: The SOAP version of the service. Default is1.1
. -
retries
: Number of times to retry a request. Default is0
. -
timeout
: Milliseconds to wait until a request is timed out. Default is120000
.
Running the tests
The tests can be run with npm test
.
Contributing
Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests.
License
This project is licensed under the ISC License - see the LICENSE file for details.