Skip to content

Commit d2f9c05

Browse files
add soap support (#85)
* add soap support * fix * readme * soap 5.0.2 * remove dev * fix vuln --------- Co-authored-by: Pavlo Voropaiev <pavel.voropaiev@elastic.io>
1 parent fd00129 commit d2f9c05

7 files changed

Lines changed: 2126 additions & 546 deletions

File tree

.nsprc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,21 @@
1010
"GHSA-6rw7-vpxm-498p": {
1111
"active": true,
1212
"notes": "qs vulnerability in request (via co-request). This is a transitive dependency. The deprecated 'request' library is used by co-request. Waiting on upstream libraries to upgrade."
13+
},
14+
"GHSA-43fc-jf86-j433": {
15+
"active": true,
16+
"notes": "Axios is Vulnerable to Denial of Service via __proto__ Key in mergeConfig. This is a transitive dependency. Waiting on upstream libraries to upgrade."
17+
},
18+
"GHSA-3ppc-4f35-3m26": {
19+
"active": true,
20+
"notes": "minimatch ReDoS via repeated wildcards. minimatch is only used with static, developer-defined glob patterns in this project; no user input is passed as patterns. Waiting on upstream libraries to upgrade."
21+
},
22+
"GHSA-7r86-cg39-jmmj": {
23+
"active": true,
24+
"notes": "minimatch ReDoS via multiple non-adjacent GLOBSTAR segments. minimatch is only used with static, developer-defined glob patterns in this project; no user input is passed as patterns. Waiting on upstream libraries to upgrade."
25+
},
26+
"GHSA-23c5-xmqv-rm74": {
27+
"active": true,
28+
"notes": "minimatch ReDoS via nested extglobs. minimatch is only used with static, developer-defined glob patterns in this project; no user input is passed as patterns. Waiting on upstream libraries to upgrade."
1329
}
1430
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.2.15 (February 27, 2026)
2+
3+
* Add `strong-soap` v5.0.7 lib support
4+
15
## 1.2.14 (February 04, 2026)
26

37
* Update Sailor version to 2.7.8

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Built-in Node.js global objects are also supported.
3434
### Other Libraries/functions
3535
- `wait(numberOfMilliscondsToSleep)` - Utility function for sleeping
3636
- [`request`](https://github.com/request/request) - Http Client (wrapped in `co` - [this library](https://www.npmjs.com/package/co-request) so that it is pre-promisified)
37+
- [`strong-soap`](https://github.com/loopbackio/strong-soap) - SOAP client for invoking web services
3738
- `_` - [Lodash](https://lodash.com/)
3839

3940
## Code component usage Examples
@@ -91,6 +92,42 @@ async function run(msg, cfg, snapshot) {
9192
}
9293
```
9394

95+
### Calling a SOAP web service with strong-soap
96+
97+
The Code component exposes the [`strong-soap`](https://github.com/loopbackio/strong-soap) client as `soap`. You can call SOAP operations using async/await. Create the client with a small promise wrapper, then invoke methods (they return promises).
98+
99+
**Basic SOAP call (WSDL URL and operation args from incoming message):**
100+
101+
```JavaScript
102+
function createSoapClient(wsdlUrl, options = {}) {
103+
return new Promise((resolve, reject) => {
104+
soap.createClient(wsdlUrl, options, (err, client) => {
105+
if (err) reject(err);
106+
else resolve(client);
107+
});
108+
});
109+
}
110+
111+
async function run(msg, cfg, snapshot) {
112+
const { wsdlUrl, operation, args } = msg.body;
113+
const client = await createSoapClient(wsdlUrl);
114+
const { result } = await client[operation](args || {});
115+
await this.emit('data', { body: result });
116+
}
117+
```
118+
119+
**Calling a specific service and port:**
120+
121+
If the WSDL defines multiple services or ports, use the `ServiceName.PortName.MethodName` form (use the same `createSoapClient` helper as in the examples above):
122+
123+
```JavaScript
124+
async function run(msg, cfg, snapshot) {
125+
const client = await createSoapClient(msg.body.wsdlUrl);
126+
const { result } = await client.MyService.MyPort.MyFunction({ name: msg.body.inputName });
127+
await this.emit('data', { body: result });
128+
}
129+
```
130+
94131
## Known issues and limitations
95132

96133
- Credentials are not supported

actions/code.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const _ = require('lodash');
33
const vm = require('vm');
44
const co = require('co');
55
const request = require('co-request');
6+
const { soap } = require('strong-soap');
67

78
function wait(timeout) {
89
return new Promise((ok) => {
@@ -46,6 +47,7 @@ exports.process = async function (msg, conf, snapshot) {
4647
// Other Libraries
4748
_,
4849
request,
50+
soap,
4951
wait: wait.bind(this),
5052
});
5153
this.logger.debug('Running the code...');

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"title": "Node.js Code",
3-
"version": "1.2.14",
3+
"version": "1.2.15",
44
"description": "You can write your own code and deploy it as part of integration process.",
55
"docsUrl": "http://go2.elastic.io/code-component",
66
"fields": {

0 commit comments

Comments
 (0)