Skip to content

Commit 0ef7f45

Browse files
init (#5)
* init * readme * soap 5.0.2 * overrides uuid 11.0.3 * soap 5.0.2 * fix vuln * remove dev --------- Co-authored-by: Pavlo Voropaiev <pavel.voropaiev@elastic.io> Co-authored-by: pavel.voropaiev <voropaiev@gmail.com>
1 parent 2ba29e5 commit 0ef7f45

8 files changed

Lines changed: 990 additions & 172 deletions

File tree

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2.1
22
parameters:
33
node-version:
44
type: string
5-
default: "18.13.0"
5+
default: "24.10.0"
66
orbs:
77
node: circleci/node@5.0.0
88
slack: circleci/slack@4.5.3
@@ -72,7 +72,7 @@ commands:
7272
jobs:
7373
test:
7474
docker: # run the steps with Docker
75-
- image: cimg/node:18.13.0
75+
- image: cimg/node:24.10.0
7676
steps:
7777
- checkout
7878
- node/install:
@@ -88,7 +88,7 @@ jobs:
8888
command: npm test
8989
build:
9090
docker:
91-
- image: cimg/node:18.13.0
91+
- image: cimg/node:24.10.0
9292
user: root
9393
steps:
9494
- checkout

.nsprc

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
{
2-
"GHSA-27h2-hvpr-p74q": {
2+
"GHSA-fjxv-7rqg-78g4": {
33
"active": true,
4-
"notes": "We don't use verify function from jsonwebtoken, so not affected"
4+
"notes": "This vulnerability is in form-data used transitively via deprecated 'request' library. We do not use form-data directly. Waiting on upstream libraries to upgrade."
55
},
6-
"GHSA-wc69-rhjr-hc9g": {
6+
"GHSA-869p-cjfg-cm3x": {
77
"active": true,
8-
"notes": "Bunyan library set only new Date to momentjs as parameter"
8+
"notes": "jws vulnerability in jsonwebtoken (via @elastic.io/maester-client -> elasticio-sailor-nodejs). This is a transitive dependency from sailor. Waiting on upstream libraries to upgrade."
99
},
10-
"GHSA-hrpp-h998-j3pp": {
10+
"GHSA-6rw7-vpxm-498p": {
1111
"active": true,
12-
"notes": "There is no query-string user input in sailor"
12+
"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."
1313
},
14-
"GHSA-fjxv-7rqg-78g4": {
15-
"active": true
14+
"GHSA-23c5-xmqv-rm74": {
15+
"active": true,
16+
"notes": "minimatch ReDoS via nested extglobs. minimatch is only used with static patterns in this project (no user-controlled glob patterns), so the risk of exploitation is negligible. Waiting on upstream libraries to upgrade."
17+
},
18+
"GHSA-3ppc-4f35-3m26": {
19+
"active": true,
20+
"notes": "minimatch ReDoS via repeated wildcards with non-matching literal in pattern. minimatch is only used with static patterns in this project (no user-controlled glob patterns), so the risk of exploitation is negligible. Waiting on upstream libraries to upgrade."
21+
},
22+
"GHSA-7r86-cg39-jmmj": {
23+
"active": true,
24+
"notes": "minimatch ReDoS via combinatorial backtracking in matchOne() with multiple non-adjacent GLOBSTAR segments. minimatch is only used with static patterns in this project (no user-controlled glob patterns), so the risk of exploitation is negligible. Waiting on upstream libraries to upgrade."
1625
}
17-
}
26+
}

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 1.0.2 (February 27, 2026)
2+
* Updated the following dependencies:
3+
* Node.js version 22 -> 24
4+
* axios 1.12.2 -> 1.13.5
5+
* elasticio-sailor-nodejs 2.7.6 -> 2.7.8
6+
* Added `strong-soap` v5.0.7 lib support
7+
* Removed unused `elasticio-node` dependency
8+
19
## 1.0.1 (September 26, 2025)
210
* Updated the following dependencies:
311
* Node.js version 18 -> 22

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Built-in Node.js global objects are also supported.
5454
- [`axios`](https://github.com/axios/axios) - A well-known HTTP Client [Documentation](https://www.npmjs.com/package/axios)
5555
- [`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). We recommend using `axios`. Support for `request` is maintained for backward compatibility only.
5656
- `_` - [Lodash](https://lodash.com/)
57+
- [`strong-soap`](https://github.com/loopbackio/strong-soap) - SOAP client for invoking web services
5758

5859
## Credentials
5960

@@ -200,3 +201,64 @@ async function run(msg, cfg, snapshot) {
200201
await this.emit('data', { body: data });
201202
}
202203
```
204+
205+
### Calling a SOAP web service with strong-soap
206+
207+
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).
208+
209+
**Basic SOAP call (WSDL URL and operation args from incoming message):**
210+
211+
```JavaScript
212+
function createSoapClient(wsdlUrl, options = {}) {
213+
return new Promise((resolve, reject) => {
214+
soap.createClient(wsdlUrl, options, (err, client) => {
215+
if (err) reject(err);
216+
else resolve(client);
217+
});
218+
});
219+
}
220+
221+
async function run(msg, cfg, snapshot) {
222+
const { wsdlUrl, operation, args } = msg.body;
223+
const client = await createSoapClient(wsdlUrl);
224+
const { result } = await client[operation](args || {});
225+
await this.emit('data', { body: result });
226+
}
227+
```
228+
229+
**SOAP with Basic authentication (using component credentials):**
230+
231+
```JavaScript
232+
function createSoapClient(wsdlUrl, options = {}) {
233+
return new Promise((resolve, reject) => {
234+
soap.createClient(wsdlUrl, options, (err, client) => {
235+
if (err) reject(err);
236+
else resolve(client);
237+
});
238+
});
239+
}
240+
241+
async function run(msg, cfg, snapshot) {
242+
const { wsdlUrl, operation, args } = msg.body;
243+
const client = await createSoapClient(wsdlUrl);
244+
245+
if (cfg.credentials && cfg.credentials.username) {
246+
client.setSecurity(new soap.BasicAuthSecurity(cfg.credentials.username, cfg.credentials.password));
247+
}
248+
249+
const { result } = await client[operation](args || {});
250+
await this.emit('data', { body: result });
251+
}
252+
```
253+
254+
**Calling a specific service and port:**
255+
256+
If the WSDL defines multiple services or ports, use the `ServiceName.PortName.MethodName` form (use the same `createSoapClient` helper as in the examples above):
257+
258+
```JavaScript
259+
async function run(msg, cfg, snapshot) {
260+
const client = await createSoapClient(msg.body.wsdlUrl);
261+
const { result } = await client.MyService.MyPort.MyFunction({ name: msg.body.inputName });
262+
await this.emit('data', { body: result });
263+
}
264+
```

actions/code.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
const _ = require('lodash');
33
const axios = require('axios');
44
const vm = require('vm');
5-
const { messages } = require('elasticio-node');
65
const co = require('co');
76
const request = require('co-request');
7+
const { soap } = require('strong-soap');
88

99
function wait(timeout) {
1010
return new Promise((ok) => {
@@ -16,6 +16,11 @@ function wait(timeout) {
1616
});
1717
}
1818

19+
const messages = {
20+
newMessageWithBody: (body) => ({ body, headers: {} }),
21+
newEmptyMessage: () => ({ body: {}, headers: {} }),
22+
};
23+
1924
// eslint-disable-next-line consistent-return,func-names
2025
exports.process = async function (msg, conf, snapshot) {
2126
const vmExports = {};
@@ -43,6 +48,7 @@ exports.process = async function (msg, conf, snapshot) {
4348
// Other Libraries
4449
_,
4550
axios,
51+
soap,
4652
request,
4753
wait: wait.bind(this),
4854
});

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 with Credentials",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "You can write your own code and deploy it as part of integration process. With the use of credentials.",
55
"docsUrl": "https://docs.elastic.io/components/code-with-credentials/index.html",
66
"authClientTypes": [

0 commit comments

Comments
 (0)