I am trying to consume a SOAP service using node-soap using WSSecurityCert
. The service requires me to set the timestamp in such a way that the SOAP request has a validity of 5 minutes and wsu
prefix. The node-soap
library has 10 minutes of validity “hard-coded”, with no obvious way to override it. I don’t know how or if I can just modify the timestamp before it is sent, because the WSSecurityCert
signature might be invalidated.
My code:
const client = await soap.createClientAsync(url);
const securityOptions = {
hasTimeStamp: true,
}
const wsSecurity = new soap.WSSecurityCert(PRIVATE_KEY, PUBLIC_CERT, '', securityOptions);
client.setSecurity(wsSecurity);
const result = await client.method(args);
The generated timestamp looks like this:
<Timestamp
xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
Id="_1">
<Created>2024-05-08T13:20:09Z</Created>
<Expires>2024-05-08T13:30:09Z</Expires>
</Timestamp>
I need to make the timestamp look something like this:
<wsu:Timestamp wsu:Id="TS-7C14BF4AA3E26845E015637928928701">
<wsu:Created>2024-05-08T13:20:09Z</wsu:Created>
<wsu:Expires>2024-05-08T13:25:09Z</wsu:Expires>
</wsu:Timestamp>
I tried to add created
and expires
among other things to securityOptions
, to no avail.
Is it possible to achieve this with the node-soap library without forking it?