How to use soap - 10 common examples

To help you get started, we’ve selected a few 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 trayio / threadneedle / tests / soapServer / index.js View on Github external
constructor (port = 8000) {

		this.port = port;
		this.soapService = soapService;
		this.wsdlXML = wsdlXML;

		const server = this.server = http.createServer((request, response) => {
			response.end('404: Not Found: ' + request.url);
		});

		this.soapServer = SOAP.listen(server, '/default.asmx', this.soapService, this.wsdlXML);

		//Use this for debugging if needed
		// this.soapServer.on('request', (req, methodName) => {
		// 	console.log('reqest', methodName);
		// });
	}
github CommonBike / commonbike-site / zandbak / 20170410skopei_test / test_soap.js View on Github external
function testsoap() {
		var soap = require('soap');
		soap.createClient(gSkopeiURL, function(err, client) {
				// var info = client.describe();

				// var args = {Text: 'hahahoho'};
				// add_authentication(args);

		  //   client.TestWebservice(args, function(err, result) {
		  //   		if(err) {
			 //        log_line('TestWebservice - error ' + err);
		  //   		} else {
			 //        log_line(result);
		  //   		}
		  //   });

				var args = { ElockID: "170178"}; // , PeriodTill: '2017-04-30T23:59:59Z'}
				add_authentication(args);
github nrkno / tv-automation-server-core / meteor / server / api / integration / soap.ts View on Github external
let soapClient: soap.Client = await new Promise((resolve: (soapClient: soap.Client,) => any, reject) => {
		soap.createClient(url, (err, client: soap.Client) => {
			// console.log('callback', err)
			// console.log('keys', _.keys(client))
			if (err) reject(err)
			else resolve(client)
		})
	})
github itsKaynine / thailand-post / lib / TrackService.js View on Github external
TrackService.prototype.init = function init(callback) {
	var self = this;

	// Ignore self signed certificate error
	process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"

	soap.createClient(WSDL_PATH, {endpoint: ENDPOINT}, function(err, client) {
		if (err) {
			return callback(err);
		}

		updateSecurity(client);
		updateToken(client);

		var args = {
			user: self.defaultArgs.user,
			password: self.defaultArgs.password,
			deviceType: self.defaultArgs.deviceType,
			lastmessage: "",
			lang: self.defaultArgs.lang
		};

		client.MessageBoardJson(args, function(err, res) {
github kevinohara80 / dmc / lib / soap-client.js View on Github external
sfClient.getIdentity({ oauth: oauth }, function(err, res) {
    if(err) return cb(err);
    soap.createClient(mdWsdl, function(err, client) {
      if(err) return cb(err);
      //client.setSecurity(new soap.BearerSecurity(oauth.access_token));

      var header = {
        'SessionHeader': {
          'sessionId': oauth.access_token
        }
      };
      var name = '';
      var xmlns = 'http://soap.sforce.com/2006/04/metadata';
      var ns = 'urn';
      //
      client.addSoapHeader(header, name, ns, xmlns);

      // var header = [
      //   '',
github lmammino / public-transport-ireland / src / dublin-bus.ts View on Github external
/* eslint camelcase: "off" */

import { DateTime } from 'luxon'
import { createClientAsync } from 'soap'

const WSDL_URL = 'http://rtpi.dublinbus.ie/DublinBusRTPIService.asmx?WSDL'
const clientPromise = createClientAsync(WSDL_URL)

interface GetRealTimeStopDataOptions {
  readonly stopId: number
  readonly forceRefresh: boolean
}

interface GetRealTimeStopDataResponse {
  readonly GetRealTimeStopDataResult: {
    readonly diffgram: {
      readonly DocumentElement: {
        readonly StopData: Array<{
          ServiceDelivery_ResponseTimestamp: string
          MonitoredVehicleJourney_PublishedLineName: string
          MonitoredVehicleJourney_DestinationName: string
          MonitoredCall_ExpectedArrivalTime: string
          MonitoredCall_VehicleAtStop: string
github seagull-js / seagull / packages / services-soap / src / mode / base.ts View on Github external
export const getClientInternal = async (
  opts: ClientOptions
): Promise => {
  const authOptions = opts.credentials ? makeAuthOptions(opts.credentials) : {}
  const defaultOptions = { rejectUnauthorized: false, strictSSL: false }
  const endpoint = getEndpoint(opts)
  const options: IOptions = {
    endpoint,
    ...defaultOptions,
    ...authOptions,
  }
  const client: T = await createClientAsync(opts.wsdlPath, options)
  // note: the options endpoint and setEndpoint seem to set different values
  // within the client. Setting both seems to work best :-B
  client.setEndpoint(endpoint)
  opts.credentials && setSecurity(client, opts.credentials)
  return client
}
github CumberlandGroup / node-ews / lib / ews.js View on Github external
return promise((resolve, reject) => {
        // for the includes specified in the XML, the uri must be specified and set to the same location as the main EWS services.wsdl
        options.uri = wsdlFilePath;
        // replace the default blank location with the location of the EWS server uri
        options.xml = options.xml.replace('soap:address location=""','soap:address location="'+ ews.urlApi + '"');
        // create the basic http server
        var server =  require('http').createServer(function(request, response) {
          response.end('404: Not Found: ' + request.url);
        });
        // start the server
        server.listen(options.port);
        // resolve the service with soap.listen
        resolve(soap.listen(server, options));
      })
    });
github CumberlandGroup / node-ews / lib / auth / basic.js View on Github external
const BasicAuth = function(config, options) {
  if(typeof config === 'object'
    && _.has(config, 'host')
    && _.has(config, 'username')
    && _.has(config, 'password')
  ) {
    return {
      wsdlOptions: {},
      authProfile: new soap.BasicAuthSecurity(config.username, config.password, options),
      getUrl: function(url, filePath) {
        // request options
        let requestOptions = { 'auth': { 'user': config.username, 'pass': config.password, 'sendImmediately': false } };
        requestOptions = _.merge(requestOptions, _.clone(options));
        requestOptions.url = url;

        return when.promise((resolve, reject) => {
          request(requestOptions, function(err, res, body) {
            if(err) reject(err);
            else if(res.statusCode == 401) reject(new Error('Basic Auth StatusCode 401: Unauthorized.'));
            else fs.writeFile(filePath, body, function(err) {
              if(err) reject(err);
              else resolve(filePath);
            });
          });
        });
github CumberlandGroup / node-ews / lib / auth / bearer.js View on Github external
const BearerAuth = function(config, options) {
  if(typeof config === 'object'
    && _.has(config, 'host')
    && _.has(config, 'username')
    && _.has(config, 'token')
  ) {
    return {
      wsdlOptions: {},
      authProfile: new soap.BearerSecurity(config.token, options),
      getUrl: function(url, filePath) {
        // request options
        let requestOptions = {
          auth: {
            bearer: config.token
          }
        };
        requestOptions = _.merge(requestOptions, _.clone(options));
        requestOptions.url = url;

        return when.promise((resolve, reject) => {
          request(requestOptions, function(err, res, body) {
            if(err) reject(err);
            else if(res.statusCode == 401) reject(new Error('Bearer Auth StatusCode 401: Unauthorized.'));
            else fs.writeFile(filePath, body, function(err) {
              if(err) reject(err);