https-proxy-agent
package to send requests via a http proxy, the code works with proxy in version 0.39.0 but not latest (I am not testing 0.41.0 but I think the issue is here)
Hi all, I upgraded from v 0.37.0 to 0.40.0 and I noticed a change in how errors are returned.
I'm using a WSDL instance and the same request with 0.37.0 returns an error like this:
{
"root":{
"Envelope":{
"Body":{
"Fault":{
"faultcode":"soap:Server",
"faultstring":"Il codice fiscale non e' nel formato corretto di 16 caratteri",
"detail":{
"WSException":{
"error":"3",
"message":"Il codice fiscale non e' nel formato corretto di 16 caratteri"
}
}
}
}
}
}
}
With 0.40.0 I get this (I replaced some informations with ...):
{
"message":"Request failed with status code 500",
"name":"Error",
"stack":"Error: Request failed with status code 500\n at createError (/usr/local/src/liveid/api/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/src/liveid/api/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/src/liveid/api/node_modules/axios/lib/adapters/http.js:260:11)\n at IncomingMessage.emit (events.js:326:22)\n at IncomingMessage.EventEmitter.emit (domain.js:483:12)\n at endReadableNT (_stream_readable.js:1241:12)\n at /usr/local/src/liveid/api/node_modules/async-listener/glue.js:188:31\n at processTicksAndRejections (internal/process/task_queues.js:84:21)",
"config":{
"url": ...,
"method":"post",
"data":"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://service.ws.nam/\">...</soap:Envelope>",
"headers":{
"Accept":"text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8",
"Content-Type":"text/xml; charset=utf-8",
"User-Agent":"node-soap/0.40.0",
"Accept-Encoding":"none",
"Accept-Charset":"utf-8",
"Connection":"close",
"Host": ...,
"Content-Length":1529,
"SOAPAction":"\"\"",
"Authorization":"Basic ..."
},
"transformRequest":[
null
],
"transformResponse":[
null
],
"timeout":0,
"xsrfCookieName":"XSRF-TOKEN",
"xsrfHeaderName":"X-XSRF-TOKEN",
"maxContentLength":-1,
"maxBodyLength":-1
}
}
Does anybody have some ideas of why this happens and how to restore an error like the one I get with 0.37.0 (beside from downgrading to 0.37.0 :P)?
hello i recently started working on soap request because of a requirement in our org.
var soap = require('soap');
var url = 'http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso';
var args = {sCountryISOCode: 'IN'};
soap.createClient(url, function(err, client) {
client.MyFunction(args, function(err, result) {
console.log(result);
});
});
i used that endpoint for testing purposes, which returns the capital of any country
I am not sure what will go in the args,
I made the same request from postman as you can see in the image
with the library i get this error
TypeError: Cannot read property 'MyFunction' of undefined
Hello group
How could I overwrite the request to inform the certificate before creating the client?
The server that has the WSDL requests mutual authentication by certificate
const options : any = {
url: `${url}`,
cert: Buffer.from(this.cert, 'utf8'),
key: Buffer.from(this.key, 'utf8'),
};
//const req = request.defaults(options);
const req = request.defaults(options);
return soap.createClient(`${url}`, {request: req}, (err: any, client: any) => {
});
But I got an error:
error -> TypeError: req.then is not a function
at HttpClient.request (C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\http.ts:184:9)
at Object.open_wsdl (C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\wsdl\index.ts:1414:16)
at openWsdl (C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\soap.ts:55:5)
at C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\soap.ts:32:7
at _requestWSDL (C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\soap.ts:61:5)
at Object.createClient (C:\Users\marco\git\facturacionelectronicapy-setapi\node_modules\soap\src\soap.ts:83:3)
Thanks
<soap:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="_30d88595-86e5-446e-b779-60b13612fe62">
<xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="ED-9cacd30b-e921-4f12-b13c-66618fd704b3" Type="http://www.w3.org/2001/04/xmlenc#Content">
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc" />
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<wsse:SecurityTokenReference xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd" wsse11:TokenType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey">
<wsse:Reference URI="#EK-e9aa9c0a-28cf-487a-81e9-a38f1e4079db" />
</wsse:SecurityTokenReference>
</ds:KeyInfo>
<xenc:CipherData>
<xenc:CipherValue>ghu/wEcFEkun4tImo++HWo3rpXU9jPw9qSA/uGhrqqAAR/LuE+6G8aFPNZ/QLDnocxvfAicieWoTlmJ5kpitjmJHW3lv95PKPyMoE/GymNVicG6qCp/HARBbk0uY+SkkSS91n7AOyGARO80aa4npggbUFdzaZlywKOMFZ6tSTDC/+0YZAfQTjecSm3xSl5C3zFX5fPgvXuVRT4AEeFnjwvja2lbJFOLc2Vhpd0tG3LGkKA111q99Qkt/o3S7/GUfimbZKQhInXioCw+t73PpKPu0JtG5YOdCuHBoJJUhW/T6DKcYdFx0exWxz7EFfa2RMK5emB9bJplPKS4fflMDpA==</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedData>
</soap:Body>
Hey everyone I am trying to create a soap server in my local that listens on https.
let key = fs.readFileSync('key.pem');
let cert = fs.readFileSync('cert.pem')
let soapServer = soap.listen(httpServer, {
path: urlPath,
services: processorService,
xml: xmlPath,
key : key,
cert : cert
});
When i am trying to make a request, I am always getting secure connection could not be established error. I have all the WSDL files and the server works properly without https ( i.e http ) .
Any pointers to help ?
hi everyone, does anybody have experience with using async with postProcess option?
i need to modify XML in postProcess, but first need to pull it through async method. postProcess just goes on without waiting.
example:postProcess: async (_xml) => {
_xml = await someMethod(_xml);
return _xml;
}
Hi! I'm getting the following error when trying to use an async client with ts-node
(node:21227) UnhandledPromiseRejectionWarning: Error: soapenv:server: java.lang.NullPointerException: {"message":null}
at finish (/Users/verner/Code/equifax/node_modules/soap/src/wsdl/index.ts:513:30)
at WSDL.xmlToObject (/Users/verner/Code/equifax/node_modules/soap/src/wsdl/index.ts:491:12)
at parseSync (/Users/verner/Code/equifax/node_modules/soap/src/client.ts:362:25)
at /Users/verner/Code/equifax/node_modules/soap/src/client.ts:575:16
at /Users/verner/Code/equifax/node_modules/soap/src/http.ts:214:7
at processTicksAndRejections (internal/process/task_queues.js:95:5)
Any ideas what could be wrong?
:point_up: Edit: Hello guys, I have updated my soap to 0.43 hence I have replaced the options.request in createClient by axiosInstance..
Below is my old code snippet =>
request.defaults({
strictSSL: true,
ca: caCert
});
and the new implementation using axios->
axiosInstance.defaults.httpsAgent = new https.Agent({
rejectUnauthorized: true,
ca: cacert
});
My options for soap.CreateClient ->
Options = {
url,
wsdl_options: {
rejectUnauthorized: true,
pfx,
passphrase,
strictSSL: true,
},
request:axiosInstance
}.
I get below error "Invalid WSDL 401 error".. Am I missing any paramter?
:point_up: Edit: Hello guys, I have updated my soap to 0.43 hence I have replaced the options.request in createClient by axiosInstance..
Below is my old code snippet =>
request.defaults({
strictSSL: true,
ca: caCert
});
and the new implementation using axios->
axiosInstance.defaults.httpsAgent = new https.Agent({
rejectUnauthorized: true,
ca: cacert
});
My options for soap.CreateClient ->
Options = {
url,
wsdl_options: {
rejectUnauthorized: true,
pfx,
passphrase,
strictSSL: true,
},
request:axiosInstance
}.
I get below error "Invalid WSDL 401 error".. Am I missing any paramter?
Code: 401
Response Body: <html><head><meta http-equiv="content-type" content="text/html; charset=windows-1252"><title>Anmeldung fehlgeschlagen
HI there! Could anyone help me with following error ?
I am using a WSDL file to create server. And I call my endpoint from SOAPUI. On my server console, I end up with error -
TypeError: Cannot read property 'description' of undefined
at SAXParser.p.onopentag (C:\Codebase\sample-domo\strong-soap-demo\node_modules\soap\lib\wsdl\index.js:238:37)
at emit (C:\Codebase\sample-domo\strong-soap-demo\node_modules\sax\lib\sax.js:624:35)
at emitNode (C:\Codebase\sample-domo\strong-soap-demo\node_modules\sax\lib\sax.js:629:5)
at openTag (C:\Codebase\sample-domo\strong-soap-demo\node_modules\sax\lib\sax.js:825:5)
at SAXParser.write (C:\Codebase\sample-domo\strong-soap-demo\node_modules\sax\lib\sax.js:1391:13)
at WSDL.xmlToObject (C:\Codebase\sample-domo\strong-soap-demo\node_modules\soap\lib\wsdl\index.js:443:11)
at Server._process (C:\Codebase\sample-domo\strong-soap-demo\node_modules\soap\lib\server.js:251:29)
at Server._processRequestXml (C:\Codebase\sample-domo\strong-soap-demo\node_modules\soap\lib\server.js:166:18)
at IncomingMessage.<anonymous> (C:\Codebase\sample-domo\strong-soap-demo\node_modules\soap\lib\server.js:235:25)
I have done the same process for another WSDL, worked fine. But this time, its just weird. ANY help is appreciated!! Please reach out if you know anything about the issue.
var soap = require('soap');
var url = './DocumentiWCFService.wsdl';
soap.createClientAsync(url).then((client) => {
var loginData = { username: MYUSER, password: MYPASS, domain: MYDOMAIN, workstation: MYWS };
client.setSecurity(new soap.NTLMSecurity(loginData));
return client.Documents_GetAll();
}).then((result) => {
console.log(result);
});
node-soap
changes the shape of the object to put the value in $value
and the attributes in attributes
, but, when it doesn't, this object is not formed. Is there any way to make this function consistently one way or the other (either with the $value object or without the $value object, preferably without)?
rawRequest
to inspect what I'm sending and I noticed that for example "date of birth" (which is in format 1979-11-24T23:00:00.000Z) is empty - any ideas why this gets omitted ?
Any idea why the overrideRootElement
option might sometimes not work?
const options = {
namespaceArrayElements: false, // This works!
envelopeKey: 'SOAP-ENV', // This works!
overrideRootElement: {
namespace: 'ns1', // This DOES NOT work!
xmlnsAttributes: [{ // This DOES NOT work!
name: 'xmlns:ns1',
value: "http://some.domain"
}]
}
}
const client = await soap.createClientAsync(MyWsdlUrl, options);
client.myApiMethod(params, (result) => {
console.log(client.lastRequest);
});
This is the XML it generates:
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<impl:myApiMethod>
Name space and xmlns attributes are not changing!
</impl:myApiMethod>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>