Hi, I'm trying to use v0.43, but it ships with a very old version of Axios 0.21, because of this it fails typescript checks when I pass it an AxiosInstance 0.26 using options.request. A couple of thoughts, I can work around it by making axios: any, not optimal.
Is there a way to not bundle axios but refer to a dependency? Or alternatively, could you just upgrade to a newer release? I believe 0.21 has security issues. https://snyk.io/vuln/npm:axios@0.21.1
Error occurred in handler for 'MSSANTE_LIST_EMAILS': TypeError: Cannot read property 'description' of undefined
at SAXParser.p.onopentag (/Users/myUser/Saturn/dist/webpack:/node_modules/soap/lib/wsdl/index.js:238:1)
at emit (/Users/myUser/Saturn/dist/webpack:/node_modules/sax/lib/sax.js:624:1)
at emitNode (/Users/myUser/Saturn/dist/webpack:/node_modules/sax/lib/sax.js:629:1)
at openTag (/Users/myUser/Saturn/dist/webpack:/node_modules/sax/lib/sax.js:825:1)
at SAXParser.write (/Users/myUser/Saturn/dist/webpack:/node_modules/sax/lib/sax.js:1391:1)
at WSDL../node_modules/soap/lib/wsdl/index.js.WSDL.xmlToObject (/Users/myUser/Saturn/dist/webpack:/node_modules/soap/lib/wsdl/index.js:443:1)
at parseSync (/Users/myUser/Saturn/dist/webpack:/node_modules/soap/lib/client.js:289:1)
at /Users/myUser/Saturn/dist/webpack:/node_modules/soap/lib/client.js:496:1
at /Users/myUser/Saturn/dist/webpack:/node_modules/soap/lib/http.js:199:1
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
I am trying to use WSSecurityCert. And I am using additionalReferences :['was:To'] to sign the tag but I am getting
Error: the following xpath cannot be signed because it was not found: //*[name(.)='wsa:To']
and also
TypeError: Cannot read property 'setSecurity' of undefined
exports.findAll = (req, res, next) => {
let server = req.body.server;
let agencyCode = req.body.agencyCode;
let branchCode = req.body.branchCode;
let transactionCode = req.body.transactionCode;
let userId = req.body.userId;
let ic = req.body.input_ic;
var date = new Date(); // Or the date you'd like converted.
var reqDate = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString();
reqDate = reqDate.substring(0, reqDate.length - 5);
const soapRequest = require('easy-soap-request');
const fs = require('fs');
const xml2js = require('xml2js');
const url = `${server}`;
const header = {
'user-agent': 'SSIPR',
'Content-Type': 'text/xml;charset=UTF-8',
};
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:crs="http://tempuri.org/CRSService">
<soapenv:Header/>
<soapenv:Body>
<crs:retrieveCitizensDataReq>
<AgencyCode>${agencyCode}</AgencyCode>
<BranchCode>${branchCode}</BranchCode>
<UserId>${userId}</UserId>
<TransactionCode>${transactionCode}</TransactionCode>
<RequestDateTime>${reqDate}</RequestDateTime>
<ICNumber>${ic}</ICNumber>
<RequestIndicator>A</RequestIndicator>
</crs:retrieveCitizensDataReq>
</soapenv:Body>
</soapenv:Envelope>`;
// usage of module
(async () => {
try{
const { response } = await soapRequest({ url: url, headers: header, xml: xml, timeout: 30000 }); // Optional timeout parameter(milliseconds)
const { headers, body, statusCode } = response;
xml2js.parseString(body.toString(),
{ tagNameProcessors: [ xml2js.processors.stripPrefix ]},
function (err, result) {
res.status(200).json(result);
})
}catch(err){
next(err);
}
})();
}
addHeaders
method of the client's security. I'm using a token which times out after 1h and refreshing that token could be done in the addHeaders
method but for that to work it would become async and the client would have to await it in its _inspect
method. Maybe we could add another optional method to the ISecurity interface called addHeadersAsync
to be backwards-compatible.
Hello, I'm having this error in a Firebase Function using soap that was working fine for the last past two years
Error: socket hang up
> at connResetException (node:internal/errors:692:14)
> at TLSSocket.socketOnEnd (node:_http_client:478:23)
> at TLSSocket.emit (node:events:539:35)
> at endReadableNT (node:internal/streams/readable:1345:12)
> at processTicksAndRejections (node:internal/process/task_queues:83:21) {
> code: 'ECONNRESET',
I made no code change no library update in the two weeks before having this issue.
I have posted on StackOverflow if you need more information :
https://stackoverflow.com/questions/73907048/firebase-functions-using-soap-finishing-with-econnreset-socket-hang-up
xs:date
and passing dates that include the time zone? If my remote server sends a valid xs:date
date such as 2022-10-30-07:00
for pacific time, the parser seems to return Invalid Date
even though this complies with the w3 XML schema for DataTypes. To work around the issue I have to save the WSDL locally and hack it so that it comes as a xs:string
then convert that to a Javascript Date
field. Seems unusual it can't deal with regular SOAP specifications that have been around forever.
Hi!
I am new to combining node.js and soap (but not new to them separately)
I have the following snippet:
console.log('About to fetch client');
const res = await fetch(wsdl);
console.log('It is available!');
console.log(await res.text());
const soapClient = createClientAsync(wsdl);
What could cause the last line to throw an error if all the previous lines succeed?
I got back
backend_1 | [ERROR] 16:57:04 TypeError: Cannot read properties of undefined (reading 'create')
TypeError: Cannot read properties of undefined (reading 'create')
at new HttpClient (/var/www/html/node_modules/soap/lib/http.js:40:59)
at Object.open_wsdl (/var/www/html/node_modules/soap/lib/wsdl/index.js:1270:48)
at openWsdl (/var/www/html/node_modules/soap/lib/soap.js:70:16)
at /var/www/html/node_modules/soap/lib/soap.js:48:13
at _requestWSDL (/var/www/html/node_modules/soap/lib/soap.js:76:9)
at createClient (/var/www/html/node_modules/soap/lib/soap.js:94:5)
at /var/www/html/node_modules/soap/lib/soap.js:104:9
at new Promise (<anonymous>)
at Object.createClientAsync (/var/www/html/node_modules/soap/lib/soap.js:103:12)
at /var/www/html/scenes/cabinetScene.js:21:35
How to solve this problem ?
const client = await soap.createClientAsync(urlWSDL, {
wsdl_headers: {Authorization: auth1С}
} );
await client.addHttpHeader('Authorization', auth1С)
const phoneAbonent = phoneClient
const abonent = {phone: phoneAbonent}
client.GetOsobr(abonent, async function (err, res) {
const result = JSON.parse(res.return)
const item = result.data
if (item.length) {
item.forEach(el => {
const numberClient1C = el.phone
ctx.session.osobrPhoneAbonent = numberClient1C
client.GetPhoneName(abonent, async function (err, res) {
const result = JSON.parse(res.return)
const item = await result.data
let name = ''
item.forEach(el => {
name = el.nameo
})
ctx.session.NameAbonet = name
await ctx.replyWithHTML(`\u{1F44B} <b>${name}</b>, `,
Markup
.keyboard([['\u{1F4DD} '\u{1F440} '], ['\u{1F4CB} '], ['\u{1F50D}'], ['\u{1F4CE} ']],)
.oneTime()
.resize())
})
ctx.scene.enter('usercabinet')
})
const soapClient = createClientAsync(wsdl);
request?: req.AxiosInstance;
I have a small question about the project and how it compiles the XML from a WSDL.
right way
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:msv3:v2">
<soap:Header/>
<soap:Body>
<urn:verbindungTesten>
<clientSoftwareKennung>TestClient</clientSoftwareKennung>
</urn:verbindungTesten>
</soap:Body>
</soap:Envelope>
wrong way
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header></soap:Header>
<soap:Body>
<verbindungTesten xmlns="urn:msv3:v2">
<clientSoftwareKennung>TestClient</clientSoftwareKennung>
</verbindungTesten>
</soap:Body>
</soap:Envelope>
Why does the client hook the namespace behind the attribute and SOAPUI does not?
I am using the soap module in Node.js as follows
import soap from "soap";
const ADRES = 'https://tckimlik.nvi.gov.tr/service/kpspublic.asmx?WSDL';
let degerler = {
TCKimlikNo: 11111111111,
Ad: 'YUSUF SEFA',
Soyad: 'SEZER',
DogumYili: 1111
};
soap.createClient(ADRES, (err, client) =\> {
client.TCKimlikNoDogrula(degerler, (err, result) =\> {
if (result.TCKimlikNoDogrulaResult) {
console.log('information is correct');
} else {
console.log('Information is incorrect');
}
});
});
However, I am getting the following error as output.
> soap@1.0.0 start
> node app.js
C:\\laragon\\www\\node-soap\\node_modules\\soap\\lib\\http.js:40
this.\_request = options.request || req\["default"\].create();
^
TypeError: Cannot read properties of undefined (reading 'create')
at new HttpClient (C:\\laragon\\www\\node-soap\\node_modules\\soap\\lib\\http.js:40:59)
at Object.open_wsdl (C:\\laragon\\www\\node-soap\\node_modules\\soap\\lib\\wsdl\\index.js:1270:48)
at openWsdl (C:\\laragon\\www\\node-soap\\node_modules\\soap\\lib\\soap.js:70:16)
at C:\\laragon\\www\\node-soap\\node_modules\\soap\\lib\\soap.js:48:13
at \_requestWSDL (C:\\laragon\\www\\node-soap\\node_modules\\soap\\lib\\soap.js:76:9)
at Object.createClient (C:\\laragon\\www\\node-soap\\node_modules\\soap\\lib\\soap.js:94:5)
at file:///C:/laragon/www/node-soap/app.js:12:6
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:526:24)
PS C:\\laragon\\www\\node-soap\>
package.json content
{
"name": "soap",
"version": "1.0.0",
"description": "",
"main": "app.js",
"type": "module",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.2",
"nodemon": "^2.0.20",
"soap": "^0.45.0"
}
}
What is the reason for this error? Despite all the searches on the internet, I could not find the solution for this. Is there a problem with the version? Where is the error, I can't try this soap module of the believer because of this error.