How to use strong-soap - 10 common examples

To help you get started, we’ve selected a few strong-soap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop / loopback-connector-soap / lib / soap-connector.js View on Github external
// Copyright IBM Corp. 2013,2015. All Rights Reserved.
// Node module: loopback-connector-soap
// US Government Users Restricted Rights - Use, duplication or disclosure
// restricted by GSA ADP Schedule Contract with IBM Corp.

var g = require('strong-globalize')();
var soap = require('strong-soap').soap;
var debug = require('debug')('loopback:connector:soap');
var HttpClient = require('./http');

/**
 * Export the initialize method to loopback-datasource-juggler
 * @param {DataSource} dataSource The data source object
 * @param callback
 */
exports.initialize = function initializeDataSource(dataSource, callback) {
  var settings = dataSource.settings || {};

  var connector = new SOAPConnector(settings);

  dataSource.connector = connector;
  dataSource.connector.dataSource = dataSource;
github strongloop / loopback-connector-soap / lib / http.js View on Github external
// Copyright IBM Corp. 2015. All Rights Reserved.
// Node module: loopback-connector-soap
// US Government Users Restricted Rights - Use, duplication or disclosure
// restricted by GSA ADP Schedule Contract with IBM Corp.

'use strict';

var req = require('request');
var util = require('util');
var url = require('url');
var debug = require('debug')('loopback:connector:soap:http');
var VERSION = require('../package.json').version;

var HttpClient = require('strong-soap').soap.HttpClient;

function LBHttpClient(options, connector) {
  if (!(this instanceof LBHttpClient)) {
    return new LBHttpClient(options, connector);
  }
  var httpClient = new HttpClient(this, options);
  this.req = req;
  if (options && options.requestOptions) {
    this.req = req.defaults(options.requestOptions);
  }
  this.connector = connector;
}

util.inherits(LBHttpClient, HttpClient);

/**
github strongloop / generator-loopback / soap / wsdl-loader.js View on Github external
// Copyright IBM Corp. 2017,2019. All Rights Reserved.
// Node module: generator-loopback
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

'use strict';
var url = require('url');
var chalk = require('chalk');

var fs = require('fs');
var async = require('async');
var soapGenerator = require('loopback-soap');
var soap = require('strong-soap').soap;
var WSDL = soap.WSDL;
var path = require('path');

var selectedWsdl, selectedWsdlUrl, wsdlServices,
  selectedService, selectedBinding;

// loads remote WSDL or local WSDL using strong-soap module APIs.
function loadWsdl(wsdlUrl, log, cb) {
  WSDL.open(wsdlUrl, {}, function(err, wsdl) {
    if (err) {
      return cb(err);
    }
    cb(null, wsdl);
  });
}
github strongloop / generator-loopback / soap / wsdl-loader.js View on Github external
// Copyright IBM Corp. 2017,2019. All Rights Reserved.
// Node module: generator-loopback
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

'use strict';
var url = require('url');
var chalk = require('chalk');

var fs = require('fs');
var async = require('async');
var soapGenerator = require('loopback-soap');
var soap = require('strong-soap').soap;
var WSDL = soap.WSDL;
var path = require('path');

var selectedWsdl, selectedWsdlUrl, wsdlServices,
  selectedService, selectedBinding;

// loads remote WSDL or local WSDL using strong-soap module APIs.
function loadWsdl(wsdlUrl, log, cb) {
  WSDL.open(wsdlUrl, {}, function(err, wsdl) {
    if (err) {
      return cb(err);
    }
    cb(null, wsdl);
  });
}

// get services defined in the wsdl
github revskill10 / next-template / api / core / create-soap-client.js View on Github external
const soap = require('strong-soap').soap;

async function createSoapClient(url, options={}) {  
  return new Promise(function (resolve, reject) {
    soap.createClient(url, options, function(err, client) {
      if (err) {
        return reject(err)
      } else {
        return resolve(client)
      }
    })
  })
}

module.exports = {
  createSoapClient,
}
github revskill10 / next-template / api / core / create-soap-client.js View on Github external
return new Promise(function (resolve, reject) {
    soap.createClient(url, options, function(err, client) {
      if (err) {
        return reject(err)
      } else {
        return resolve(client)
      }
    })
  })
}
github strongloop / loopback-connector-soap / lib / soap-connector.js View on Github external
SOAPConnector.prototype.connect = function (cb) {
  var self = this;
  if (self.client) {
    process.nextTick(function () {
      cb && cb(null, self.client);
    });
    return;
  }
  if (debug.enabled) {
    debug('Reading wsdl: %s', self.wsdl);
  }
  soap.createClient(self.wsdl, self.settings, function (err, client) {
    if (!err) {
      if (debug.enabled) {
        debug('wsdl loaded: %s', self.wsdl);
      }
      if (self.settings.security || self.settings.username) {
        var sec = null;
        var secConfig = self.settings.security || self.settings;
        if (debug.enabled) {
          debug('configuring security: %j', secConfig);
        }
        switch (secConfig.scheme) {
          case 'WS':
          case 'WSSecurity':
            sec = new soap.WSSecurity(secConfig.username, secConfig.password,
              secConfig.passwordType || secConfig.options);
            break;
github strongloop / loopback-connector-soap / lib / soap-connector.js View on Github external
} else {
              sec = new soap.ClientSSLSecurity(
                secConfig.keyPath || secConfig.key,
                secConfig.certPath || secConfig.cert,
                secConfig.ca || secConfig.caPath,
                secConfig.options);
            }
            break;
          case 'Bearer':
            sec = new soap.BearerSecurity(
              secConfig.token,
              secConfig.options);
            break;
          case 'BasicAuth':
          default:
            sec = new soap.BasicAuthSecurity(
              secConfig.username, secConfig.password, secConfig.options);
            break;
        }
        if (sec) {
          client.setSecurity(sec);
        }
      }
      if (self.settings.soapAction || self.settings.SOAPAction) {
        client.setSOAPAction(self.settings.soapAction || self.settings.SOAPAction);
      }

      if (Array.isArray(self.settings.soapHeaders)) {
        self.settings.soapHeaders.forEach(function (header) {
          if (debug.enabled) {
            debug('adding soap header: %j', header);
          }
github strongloop / loopback-connector-soap / lib / soap-connector.js View on Github external
if (secConfig.pfx) {
              sec = new soap.ClientSSLSecurityPFX(
                secConfig.pfx,
                secConfig.passphrase,
                secConfig.options
              );
            } else {
              sec = new soap.ClientSSLSecurity(
                secConfig.keyPath || secConfig.key,
                secConfig.certPath || secConfig.cert,
                secConfig.ca || secConfig.caPath,
                secConfig.options);
            }
            break;
          case 'Bearer':
            sec = new soap.BearerSecurity(
              secConfig.token,
              secConfig.options);
            break;
          case 'BasicAuth':
          default:
            sec = new soap.BasicAuthSecurity(
              secConfig.username, secConfig.password, secConfig.options);
            break;
        }
        if (sec) {
          client.setSecurity(sec);
        }
      }
      if (self.settings.soapAction || self.settings.SOAPAction) {
        client.setSOAPAction(self.settings.soapAction || self.settings.SOAPAction);
      }
github strongloop / loopback-connector-soap / lib / soap-connector.js View on Github external
sec = new soap.WSSecurityCert(
              secConfig.privatePEM,
              secConfig.publicP12PEM,
              secConfig.password,
              secConfig.encoding
            );
            break;
          case 'ClientSSL':
            if (secConfig.pfx) {
              sec = new soap.ClientSSLSecurityPFX(
                secConfig.pfx,
                secConfig.passphrase,
                secConfig.options
              );
            } else {
              sec = new soap.ClientSSLSecurity(
                secConfig.keyPath || secConfig.key,
                secConfig.certPath || secConfig.cert,
                secConfig.ca || secConfig.caPath,
                secConfig.options);
            }
            break;
          case 'Bearer':
            sec = new soap.BearerSecurity(
              secConfig.token,
              secConfig.options);
            break;
          case 'BasicAuth':
          default:
            sec = new soap.BasicAuthSecurity(
              secConfig.username, secConfig.password, secConfig.options);
            break;