-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Versions Affected: >= 1.4.0 (works in 1.3.0, broken in 1.4.0)
Environment: Node.js 22, Express
Summary
After upgrading from 0.43.0 → 1.6.x, SOAP messages sent by our system stopped parsing correctly.
The root cause is that the library hardcodes ENV_URI = 'http://schemas.xmlsoap.org/soap/envelope/', and treats only this namespace as a valid SOAP envelope.
However, our system sends SOAP 1.2 envelopes:
http://www.w3.org/2003/05/soap-envelope
When the incoming XML uses a different namespace, onopentag never recognizes <Envelope>, <Header>, or <Body>, causing the entire SOAP body to fail parsing.
In v1.3.0 this did not happen.
Example Broken Incoming Message
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>...</soap:Header>
<soap:Body>...</soap:Body>
</soap:Envelope>
node-soap expects only:
http://schemas.xmlsoap.org/soap/envelope/
This is why previously parsed integers (s:int) are now returned as "1" etc(for our case).
Exact Location of the Problem
Inside the SAX open-tag handler (simplified):
const ENV_URI = 'http://schemas.xmlsoap.org/soap/envelope/';
...
if (!objectName && xmlns[envPrefix] && top.name === 'Body' && name !== 'Fault') {...}
Expected Behavior
The library should accept both SOAP 1.1 and SOAP 1.2 envelope namespaces or allow overriding via options.
Valid URIs:
http://schemas.xmlsoap.org/soap/envelope/ (SOAP 1.1)
http://www.w3.org/2003/05/soap-envelope (SOAP 1.2)
Or provide a configuration option:
{ acceptedEnvelopeURIs: [...] }