How to use the soap.createClientAsync function in soap

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 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 emilioastarita / facturajs / src / AfipHelper.ts View on Github external
private getSoapClient(serviceName: WsServicesNames): any {
        const urls = this.urls[this.getAfipEnvironment()];
        const type = serviceName === "login" ? "login" : "service";
        const url = urls[type].replace("{name}", encodeURIComponent(serviceName));
        return soap.createClientAsync(url, {
            namespaceArrayElements: false,
        });
    }
github lmammino / public-transport-ireland / src / dublin-bus / index.js View on Github external
async function main () {
  const client = await soap.createClientAsync(WSDL_URL)
  const stopId = Number(process.argv[2])
  getRealTimeInfoForStop(client, stopId)
}
github nkjm / bot-express / sample_service / rightnow.js View on Github external
static create_client(wsdl, wss_security, app_id){
        debug("create_client() started.");

        return soap.createClientAsync(wsdl).then(
            (client) => {
                debug("Rightnow soap client created.");
                client.setSecurity(wss_security);
                client.addSoapHeader(
                    {
                        ClientInfoHeader: {
                            AppID : app_id
                        }
                    },         //soapHeader Object({rootName: {name: "value"}}) or strict xml-string
                    '',         //name Unknown parameter (it could just a empty string)
                    'rnm_v1',   //namespace prefix of xml namespace
                    ''          //xmlns URI
                );
                return client;
            }
        )