Comparing version 1.0.4 to 1.1.0
@@ -9,10 +9,10 @@ "use strict"; | ||
const assert = require("assert"); | ||
const debugBuilder = require("debug"); | ||
const crypto_1 = require("crypto"); | ||
const debug_1 = require("debug"); | ||
const events_1 = require("events"); | ||
const getStream = require("get-stream"); | ||
const _ = require("lodash"); | ||
const uuid_1 = require("uuid"); | ||
const http_1 = require("./http"); | ||
const utils_1 = require("./utils"); | ||
const debug = debugBuilder('node-soap'); | ||
const debug = (0, debug_1.default)('node-soap'); | ||
const nonIdentifierChars = /[^a-z$_0-9]/i; | ||
@@ -368,3 +368,3 @@ class Client extends events_1.EventEmitter { | ||
this.lastEndpoint = location; | ||
const eid = options.exchangeId || (0, uuid_1.v4)(); | ||
const eid = options.exchangeId || (0, crypto_1.randomUUID)(); | ||
this.emit('message', message, eid); | ||
@@ -371,0 +371,0 @@ this.emit('request', xml, eid); |
@@ -10,9 +10,9 @@ "use strict"; | ||
const axios_ntlm_1 = require("axios-ntlm"); | ||
const debugBuilder = require("debug"); | ||
const crypto_1 = require("crypto"); | ||
const debug_1 = require("debug"); | ||
const url = require("url"); | ||
const uuid_1 = require("uuid"); | ||
const MIMEType = require("whatwg-mimetype"); | ||
const zlib_1 = require("zlib"); | ||
const utils_1 = require("./utils"); | ||
const debug = debugBuilder('node-soap'); | ||
const debug = (0, debug_1.default)('node-soap'); | ||
const VERSION = require('../package.json').version; | ||
@@ -74,3 +74,3 @@ /** | ||
if (exoptions.forceMTOM || attachments.length > 0) { | ||
const start = (0, uuid_1.v4)(); | ||
const start = (0, crypto_1.randomUUID)(); | ||
let action = null; | ||
@@ -84,3 +84,3 @@ if (headers['Content-Type'].indexOf('action') > -1) { | ||
} | ||
const boundary = (0, uuid_1.v4)(); | ||
const boundary = (0, crypto_1.randomUUID)(); | ||
headers['Content-Type'] = 'multipart/related; type="application/xop+xml"; start="<' + start + '>"; start-info="text/xml"; boundary=' + boundary; | ||
@@ -87,0 +87,0 @@ if (action) { |
@@ -30,3 +30,3 @@ import { ISecurity } from '../types'; | ||
constructor(privatePEM: any, publicP12PEM: any, password: any, options?: IWSSecurityCertOptions); | ||
postProcess(xml: any, envelopeKey: any): string; | ||
postProcess(xml: string, envelopeKey: string): string; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WSSecurityCert = void 0; | ||
const uuid_1 = require("uuid"); | ||
const crypto_1 = require("crypto"); | ||
const xml_crypto_1 = require("xml-crypto"); | ||
@@ -24,3 +24,3 @@ function addMinutes(date, minutes) { | ||
function generateId() { | ||
return (0, uuid_1.v4)().replace(/-/gm, ''); | ||
return (0, crypto_1.randomUUID)().replace(/-/gm, ''); | ||
} | ||
@@ -44,7 +44,15 @@ function resolvePlaceholderInReferences(references, bodyXpath) { | ||
.replace(/(\r\n|\n|\r)/gm, ''); | ||
this.signer = new xml_crypto_1.SignedXml(options?.signerOptions?.idMode); | ||
this.signer = new xml_crypto_1.SignedXml({ idMode: options?.signerOptions?.idMode }); | ||
if (options.signatureAlgorithm === 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256') { | ||
this.signer.signatureAlgorithm = options.signatureAlgorithm; | ||
this.signer.addReference(bodyXpathPlaceholder, ['http://www.w3.org/2001/10/xml-exc-c14n#'], 'http://www.w3.org/2001/04/xmlenc#sha256'); | ||
this.signer.addReference({ | ||
xpath: bodyXpathPlaceholder, | ||
transforms: ['http://www.w3.org/2001/10/xml-exc-c14n#'], | ||
digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256', | ||
}); | ||
} | ||
if (!options.signatureAlgorithm) { | ||
this.signer.signatureAlgorithm = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'; | ||
} | ||
this.signer.canonicalizationAlgorithm = 'http://www.w3.org/2001/10/xml-exc-c14n#'; | ||
if (options.additionalReferences && options.additionalReferences.length > 0) { | ||
@@ -66,3 +74,3 @@ this.additionalReferences = options.additionalReferences; | ||
} | ||
this.signer.signingKey = { | ||
this.signer.privateKey = { | ||
key: privatePEM, | ||
@@ -75,4 +83,3 @@ passphrase: password, | ||
: ['http://www.w3.org/2000/09/xmldsig#enveloped-signature', 'http://www.w3.org/2001/10/xml-exc-c14n#']; | ||
this.signer.keyInfoProvider = {}; | ||
this.signer.keyInfoProvider.getKeyInfo = (key) => { | ||
this.signer.getKeyInfo = (key) => { | ||
return `<wsse:SecurityTokenReference>` + | ||
@@ -133,3 +140,3 @@ `<wsse:Reference URI="#${this.x509Id}" ValueType="${oasisBaseUri}/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>` + | ||
if (!(this.signer.references.filter((ref) => (ref.xpath === bodyXpath)).length > 0)) { | ||
this.signer.addReference(bodyXpath, references); | ||
this.signer.addReference({ xpath: bodyXpath, transforms: references, digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256' }); | ||
} | ||
@@ -139,3 +146,3 @@ for (const name of this.additionalReferences) { | ||
if (!(this.signer.references.filter((ref) => (ref.xpath === xpath)).length > 0)) { | ||
this.signer.addReference(xpath, references); | ||
this.signer.addReference({ xpath: xpath, transforms: references, digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256' }); | ||
} | ||
@@ -145,3 +152,3 @@ } | ||
if (this.hasTimeStamp && !(this.signer.references.filter((ref) => (ref.xpath === timestampXpath)).length > 0)) { | ||
this.signer.addReference(timestampXpath, references); | ||
this.signer.addReference({ xpath: timestampXpath, transforms: references, digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256' }); | ||
} | ||
@@ -148,0 +155,0 @@ this.signer.computeSignature(xmlWithSec, this.signerOptions); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WSSecurityCertWithToken = void 0; | ||
const uuid_1 = require("uuid"); | ||
const crypto_1 = require("crypto"); | ||
const xml_crypto_1 = require("xml-crypto"); | ||
@@ -24,3 +24,3 @@ function addMinutes(date, minutes) { | ||
function generateId() { | ||
return (0, uuid_1.v4)().replace(/-/gm, ''); | ||
return (0, crypto_1.randomUUID)().replace(/-/gm, ''); | ||
} | ||
@@ -50,4 +50,12 @@ function resolvePlaceholderInReferences(references, bodyXpath) { | ||
this.signer.signatureAlgorithm = opts.signatureAlgorithm; | ||
this.signer.addReference(bodyXpathPlaceholder, ['http://www.w3.org/2001/10/xml-exc-c14n#'], 'http://www.w3.org/2001/04/xmlenc#sha256'); | ||
this.signer.addReference({ | ||
xpath: bodyXpathPlaceholder, | ||
transforms: ['http://www.w3.org/2001/10/xml-exc-c14n#'], | ||
digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256', | ||
}); | ||
} | ||
if (!opts.signatureAlgorithm) { | ||
this.signer.signatureAlgorithm = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'; | ||
} | ||
this.signer.canonicalizationAlgorithm = 'http://www.w3.org/2001/10/xml-exc-c14n#'; | ||
if (opts.additionalReferences && opts.additionalReferences.length > 0) { | ||
@@ -69,3 +77,3 @@ this.additionalReferences = opts.additionalReferences; | ||
} | ||
this.signer.signingKey = { | ||
this.signer.privateKey = { | ||
key: props.privateKey, | ||
@@ -79,3 +87,3 @@ passphrase: props.keyPassword, | ||
this.signer.keyInfoProvider = {}; | ||
this.signer.keyInfoProvider.getKeyInfo = (key) => { | ||
this.signer.getKeyInfo = (key) => { | ||
return `<wsse:SecurityTokenReference>` + | ||
@@ -119,3 +127,3 @@ `<wsse:Reference URI="#${this.x509Id}" ValueType="${oasisBaseUri}/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>` + | ||
if (!(this.signer.references.filter((ref) => (ref.xpath === bodyXpath)).length > 0)) { | ||
this.signer.addReference(bodyXpath, references); | ||
this.signer.addReference({ xpath: bodyXpath, transforms: references, digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256' }); | ||
} | ||
@@ -125,3 +133,3 @@ for (const name of this.additionalReferences) { | ||
if (!(this.signer.references.filter((ref) => (ref.xpath === xpath)).length > 0)) { | ||
this.signer.addReference(xpath, references); | ||
this.signer.addReference({ xpath: xpath, transforms: references, digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256' }); | ||
} | ||
@@ -131,3 +139,3 @@ } | ||
if (this.hasTimeStamp && !(this.signer.references.filter((ref) => (ref.xpath === timestampXpath)).length > 0)) { | ||
this.signer.addReference(timestampXpath, references); | ||
this.signer.addReference({ xpath: timestampXpath, transforms: references, digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256' }); | ||
} | ||
@@ -134,0 +142,0 @@ this.signer.computeSignature(xmlWithSec, this.signerOptions); |
@@ -11,7 +11,7 @@ /// <reference types="node" /> | ||
} | ||
export declare type ServerType = http.Server | IExpressApp; | ||
declare type Request = http.IncomingMessage & { | ||
export type ServerType = http.Server | IExpressApp; | ||
type Request = http.IncomingMessage & { | ||
body?: any; | ||
}; | ||
declare type Response = http.ServerResponse; | ||
type Response = http.ServerResponse; | ||
export interface Server { | ||
@@ -31,3 +31,3 @@ emit(event: 'request', request: any, methodName: string): boolean; | ||
services: IServices; | ||
log: (type: string, data: any) => any; | ||
log: (type: string, data: any, req: Request) => any; | ||
authorizeConnection: (req: Request, res?: Response) => boolean; | ||
@@ -34,0 +34,0 @@ authenticate: (security: any, processAuthResult?: (result: boolean) => void, req?: Request, obj?: any) => boolean | void | Promise<boolean>; |
@@ -148,3 +148,3 @@ "use strict"; | ||
if (typeof this.log === 'function') { | ||
this.log('received', xml); | ||
this.log('received', xml, req); | ||
} | ||
@@ -154,3 +154,3 @@ this._process(xml, req, res, (result, statusCode) => { | ||
if (typeof this.log === 'function') { | ||
this.log('replied', result); | ||
this.log('replied', result, req); | ||
} | ||
@@ -164,3 +164,3 @@ }); | ||
if (typeof this.log === 'function') { | ||
this.log('error', err); | ||
this.log('error', err, req); | ||
} | ||
@@ -173,3 +173,3 @@ }, new Date().toISOString()); | ||
if (typeof this.log === 'function') { | ||
this.log('error', error); | ||
this.log('error', error, req); | ||
} | ||
@@ -184,3 +184,3 @@ } | ||
if (typeof this.log === 'function') { | ||
this.log('info', 'Handling ' + req.method + ' on ' + req.url); | ||
this.log('info', 'Handling ' + req.method + ' on ' + req.url, req); | ||
} | ||
@@ -190,3 +190,3 @@ if (req.method === 'GET') { | ||
if (typeof this.log === 'function') { | ||
this.log('info', 'Wants the WSDL'); | ||
this.log('info', 'Wants the WSDL', req); | ||
} | ||
@@ -257,3 +257,3 @@ res.setHeader('Content-Type', 'application/xml'); | ||
if (typeof this.log === 'function') { | ||
this.log('info', 'Attempting to bind to ' + pathname); | ||
this.log('info', 'Attempting to bind to ' + pathname, req); | ||
} | ||
@@ -279,3 +279,3 @@ // Avoid Cannot convert undefined or null to object due to Object.keys(body) | ||
if (typeof this.log === 'function') { | ||
this.log('info', 'Trying ' + portName + ' from path ' + portPathname); | ||
this.log('info', 'Trying ' + portName + ' from path ' + portPathname, req); | ||
} | ||
@@ -282,0 +282,0 @@ if (portPathname === pathname) { |
@@ -13,3 +13,3 @@ import { Client } from './client'; | ||
export { WSDL } from './wsdl'; | ||
export declare type CreateClientCallback = (err: any, client: Client) => void; | ||
export type CreateClientCallback = (err: any, client: Client) => void; | ||
export declare function createClient(url: string, callback: CreateClientCallback, endpoint?: string): void; | ||
@@ -16,0 +16,0 @@ export declare function createClient(url: string, options: IOptions, callback: CreateClientCallback, endpoint?: string): void; |
@@ -22,3 +22,3 @@ "use strict"; | ||
exports.listen = exports.createClientAsync = exports.createClient = exports.WSDL = exports.passwordDigest = exports.Server = exports.WSSecurityCertWithToken = exports.WSSecurityPlusCert = exports.WSSecurityCert = exports.WSSecurity = exports.NTLMSecurity = exports.ClientSSLSecurityPFX = exports.ClientSSLSecurity = exports.BearerSecurity = exports.BasicAuthSecurity = exports.HttpClient = exports.Client = exports.security = void 0; | ||
const debugBuilder = require("debug"); | ||
const debug_1 = require("debug"); | ||
const client_1 = require("./client"); | ||
@@ -28,3 +28,3 @@ const _security = require("./security"); | ||
const wsdl_1 = require("./wsdl"); | ||
const debug = debugBuilder('node-soap:soap'); | ||
const debug = (0, debug_1.default)('node-soap:soap'); | ||
exports.security = _security; | ||
@@ -31,0 +31,0 @@ var client_2 = require("./client"); |
@@ -16,10 +16,10 @@ /// <reference types="node" /> | ||
/** @deprecated use SoapMethod */ | ||
export declare type ISoapMethod = SoapMethod; | ||
export declare type SoapMethod = (args: any, callback: (err: any, result: any, rawResponse: any, soapHeader: any, rawRequest: any, mtomAttachments?: IMTOMAttachments) => void, options?: any, extraHeaders?: any, mtomAttachments?: IMTOMAttachments) => void; | ||
export declare type SoapMethodAsync = (args: any, options?: any, extraHeaders?: any) => Promise<[any, any, any, any, IMTOMAttachments?]>; | ||
export declare type ISoapServiceMethod = (args: any, callback?: (data: any) => void, headers?: any, req?: any, res?: any, sender?: any) => any; | ||
export type ISoapMethod = SoapMethod; | ||
export type SoapMethod = (args: any, callback: (err: any, result: any, rawResponse: any, soapHeader: any, rawRequest: any, mtomAttachments?: IMTOMAttachments) => void, options?: any, extraHeaders?: any, mtomAttachments?: IMTOMAttachments) => void; | ||
export type SoapMethodAsync = (args: any, options?: any, extraHeaders?: any) => Promise<[any, any, any, any, IMTOMAttachments?]>; | ||
export type ISoapServiceMethod = (args: any, callback?: (data: any) => void, headers?: any, req?: any, res?: any, sender?: any) => any; | ||
export interface ISoapFaultError { | ||
Fault: ISoapFault; | ||
} | ||
export declare type ISoapFault = ISoapFault11 | ISoapFault12; | ||
export type ISoapFault = ISoapFault11 | ISoapFault12; | ||
export interface ISoapFault11 { | ||
@@ -44,3 +44,3 @@ faultcode: number | string; | ||
/** @deprecated use ISecurity */ | ||
export declare type Security = ISecurity; | ||
export type Security = ISecurity; | ||
export interface ISecurity { | ||
@@ -103,3 +103,3 @@ addOptions?(options: any): void; | ||
/** @deprecated use IOptions */ | ||
export declare type Option = IOptions; | ||
export type Option = IOptions; | ||
export interface IOptions extends IWsdlBaseOptions { | ||
@@ -106,0 +106,0 @@ /** don't cache WSDL files, request them every time. */ |
@@ -5,6 +5,6 @@ "use strict"; | ||
const assert_1 = require("assert"); | ||
const debugBuilder = require("debug"); | ||
const debug_1 = require("debug"); | ||
const _ = require("lodash"); | ||
const utils_1 = require("../utils"); | ||
const debug = debugBuilder('node-soap'); | ||
const debug = (0, debug_1.default)('node-soap'); | ||
const Primitives = { | ||
@@ -11,0 +11,0 @@ string: 1, |
@@ -88,5 +88,5 @@ import * as sax from 'sax'; | ||
} | ||
declare type WSDLCallback = (error: any, result?: WSDL) => any; | ||
type WSDLCallback = (error: any, result?: WSDL) => any; | ||
export declare function open_wsdl(uri: any, callback: WSDLCallback): any; | ||
export declare function open_wsdl(uri: any, options: IOptions, callback: WSDLCallback): any; | ||
export {}; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const assert_1 = require("assert"); | ||
const debugBuilder = require("debug"); | ||
const debug_1 = require("debug"); | ||
const fs = require("fs"); | ||
@@ -23,3 +23,3 @@ const _ = require("lodash"); | ||
const elements = require("./elements"); | ||
const debug = debugBuilder('node-soap'); | ||
const debug = (0, debug_1.default)('node-soap'); | ||
const XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance'; | ||
@@ -458,8 +458,14 @@ function trim(text) { | ||
if (body && body.Fault) { | ||
let code = body.Fault.faultcode && body.Fault.faultcode.$value; | ||
let string = body.Fault.faultstring && body.Fault.faultstring.$value; | ||
let detail = body.Fault.detail && body.Fault.detail.$value; | ||
code = code || body.Fault.faultcode; | ||
string = string || body.Fault.faultstring; | ||
detail = detail || body.Fault.detail; | ||
const fault = body.Fault; | ||
let code = fault.faultcode && fault.faultcode.$value; | ||
let string = fault.faultstring && fault.faultstring.$value; | ||
let detail = fault.detail && fault.detail.$value; | ||
code = code || fault.faultcode; | ||
string = string || fault.faultstring; | ||
detail = detail || fault.detail; | ||
// SOAP 1.2 | ||
code = code || fault.Code && `${fault.Code.Value}: ${fault.Code.Subcode && fault.Code.Subcode.Value}`; | ||
string = string || fault.Reason && fault.Reason.Text.$value; | ||
string = string || fault.Reason && fault.Reason.Text; | ||
detail = detail || fault.Detail; | ||
const error = new Error(code + ': ' + string + (detail ? ': ' + JSON.stringify(detail) : '')); | ||
@@ -466,0 +472,0 @@ error.root = root; |
{ | ||
"name": "soap", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "A minimal node SOAP client", | ||
@@ -10,13 +10,12 @@ "engines": { | ||
"dependencies": { | ||
"axios": "^1.6.8", | ||
"axios": "^1.7.2", | ||
"axios-ntlm": "^1.4.2", | ||
"debug": "^4.3.2", | ||
"formidable": "^3.2.4", | ||
"debug": "^4.3.5", | ||
"formidable": "^3.5.1", | ||
"get-stream": "^6.0.1", | ||
"lodash": "^4.17.21", | ||
"sax": ">=0.6", | ||
"sax": "^1.4.1", | ||
"strip-bom": "^3.0.0", | ||
"uuid": "^8.3.2", | ||
"whatwg-mimetype": "3.0.0", | ||
"xml-crypto": "^3.0.0" | ||
"whatwg-mimetype": "4.0.0", | ||
"xml-crypto": "^6.0.0" | ||
}, | ||
@@ -51,29 +50,28 @@ "repository": { | ||
"@types/axios": "^0.14.0", | ||
"@types/debug": "^4.1.7", | ||
"@types/express": "^4.17.13", | ||
"@types/debug": "^4.1.12", | ||
"@types/express": "^4.17.21", | ||
"@types/formidable": "^2.0.4", | ||
"@types/lodash": "^4.14.172", | ||
"@types/node": "^11.15.54", | ||
"@types/request": "^2.48.7", | ||
"@types/sax": "^1.2.3", | ||
"@types/uuid": "^8.3.1", | ||
"@types/whatwg-mimetype": "^2.1.1", | ||
"body-parser": "^1.15.2", | ||
"colors": "^1.3.3", | ||
"@types/lodash": "^4.17.5", | ||
"@types/node": "^14.0.0", | ||
"@types/sax": "^1.2.7", | ||
"@types/uuid": "^9.0.8", | ||
"@types/whatwg-mimetype": "^3.0.2", | ||
"body-parser": "^1.20.2", | ||
"colors": "^1.4.0", | ||
"coveralls": "^3.1.1", | ||
"diff": "^4.0.1", | ||
"doctoc": "^2.0.1", | ||
"duplexer": "~0.1.1", | ||
"express": "^4.16.4", | ||
"finalhandler": "^1.1.1", | ||
"glob": "^7.1.7", | ||
"jshint": "^2.13.1", | ||
"mocha": "^6.1.4", | ||
"nyc": "^14.1.1", | ||
"diff": "^5.2.0", | ||
"doctoc": "^2.2.1", | ||
"duplexer": "~0.1.2", | ||
"express": "^4.19.2", | ||
"finalhandler": "^1.2.0", | ||
"glob": "^10.4.1", | ||
"jshint": "^2.13.6", | ||
"mocha": "^10.4.0", | ||
"nyc": "^17.0.0", | ||
"readable-stream": "~2.0.2", | ||
"semver": "^5.6.0", | ||
"serve-static": "^1.14.1", | ||
"semver": "^7.6.2", | ||
"serve-static": "^1.15.0", | ||
"should": "^13.2.3", | ||
"sinon": "^1.17.7", | ||
"source-map-support": "^0.5.10", | ||
"sinon": "^18.0.0", | ||
"source-map-support": "^0.5.21", | ||
"timekeeper": "^2.1.2", | ||
@@ -80,0 +78,0 @@ "tslint": "^5.18.0", |
@@ -1,2 +0,2 @@ | ||
# Soap [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] | ||
# Soap [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] | ||
@@ -100,3 +100,3 @@ > A SOAP client and server for node.js. | ||
- `url` (*string*): A HTTP/HTTPS URL or a local filesystem path. | ||
- `url` (*string*): A HTTP/HTTPS URL, XML or a local filesystem path. | ||
- `options` (*Object*): | ||
@@ -128,2 +128,3 @@ - `endpoint` (*string*): Override the host specified by the SOAP service in the WSDL file. | ||
HTTP/HTTPS: | ||
``` javascript | ||
@@ -141,2 +142,44 @@ var soap = require('soap'); | ||
XML string format: | ||
``` javascript | ||
var soap = require('soap'); | ||
var xml = ` | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> | ||
<message name="MyFunctionRequest"/> | ||
<message name="MyFunctionResponse"/> | ||
<portType name="MyFunctionPortType"> | ||
<operation name="MyFunction"> | ||
<input message="MyFunctionRequest"/> | ||
<output message="MyFunctionResponse"/> | ||
</operation> | ||
</portType> | ||
<binding name="MyFunctionBinding" type="MyFunctionPortType"> | ||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> | ||
<operation name="MyFunction"> | ||
<soap:operation soapAction="MyFunction"/> | ||
<input><soap:body use="encoded"/></input> | ||
<output><soap:body use="encoded"/></output> | ||
</operation> | ||
</binding> | ||
<service name="MyService"> | ||
<port binding="MyFunctionBinding" name="MyFunctionPort"> | ||
<soap:address location="http://www.examples.com/MyFunction/" /> | ||
</port> | ||
</service> | ||
</definitions> | ||
`; | ||
var args = {name: 'value'}; | ||
soap.createClient(xml, {}, function(err, client) { | ||
client.MyFunction(args, function(err, result) { | ||
console.log(result); | ||
}); | ||
}); | ||
``` | ||
Note: for versions of node >0.10.X, you may need to specify `{connection: 'keep-alive'}` in SOAP headers to avoid truncation of longer chunked responses. | ||
@@ -148,3 +191,3 @@ | ||
- `url` (*string*): A HTTP/HTTPS URL or a local filesystem path. | ||
- `url` (*string*): A HTTP/HTTPS URL, XML or a local filesystem path. | ||
- `options` (*Object*): See [soap.createClient(url[, options], callback)](#soapcreateclienturl-options-callback---create-a-new-soap-client-from-a-wsdl-url-also-supports-a-local-filesystem-path) for a description. | ||
@@ -290,8 +333,11 @@ - Returns: `Promise<Client>` | ||
If the `log` method is defined, it will be called with 'received' and 'replied' along with the data. | ||
If the `log` method is defined, it will be called with: | ||
- `type`: 'received', 'replied', 'info' or 'error'. | ||
- `data`: The data to be logged which will be an XML for 'received' and 'replied' or a message for the other types. | ||
- `req`: The original request object | ||
``` javascript | ||
server = soap.listen(...) | ||
server.log = function(type, data) { | ||
// type is 'received' or 'replied' | ||
server.log = function(type, data, req) { | ||
// type is 'received', 'replied', 'info' or 'error' | ||
}; | ||
@@ -1455,5 +1501,2 @@ ``` | ||
[travis-url]: https://travis-ci.org/vpulim/node-soap | ||
[travis-image]: http://img.shields.io/travis/vpulim/node-soap.svg | ||
[gitter-url]: https://gitter.im/vpulim/node-soap | ||
@@ -1460,0 +1503,0 @@ [gitter-image]: https://badges.gitter.im/vpulim/node-soap.png |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
449480
10
31
6009
1501
+ Added@xmldom/is-dom-node@1.0.1(transitive)
+ Addedwhatwg-mimetype@4.0.0(transitive)
+ Addedxml-crypto@6.0.0(transitive)
+ Addedxpath@0.0.33(transitive)
- Removeduuid@^8.3.2
- Removeduuid@8.3.2(transitive)
- Removedwhatwg-mimetype@3.0.0(transitive)
- Removedxml-crypto@3.2.0(transitive)
- Removedxpath@0.0.32(transitive)
Updatedaxios@^1.7.2
Updateddebug@^4.3.5
Updatedformidable@^3.5.1
Updatedsax@^1.4.1
Updatedwhatwg-mimetype@4.0.0
Updatedxml-crypto@^6.0.0