I'm using this npm-module: https://github.com/vpulim/node-soap
The webservice I want to consume is only using SOAP 1.2 and returns a server error on using any other SOAP version.
Has someone experienced the same problem and knows how to set the SOAP version?
You could go into soap\lib\client.js to the line 186 and modify the envelope syntaxis so it is compliant with soap 1.2:
//modify this with the envelope used by soap1.2:
xml = "<soap:Envelope " +
"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
'xmlns:xsd="http://www.w3.org/2001/XMLSchema"' +
'xmlns:ns2="http://xml.apache.org/xml-soap"' +
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
encoding +
this.wsdl.xmlnsInEnvelope + '>' +
//until here
((self.soapHeaders || self.security) ?
(
"<soap:Header>" +
(self.soapHeaders ? self.soapHeaders.join("\n") : "") +
(self.security ? self.security.toXML() : "") +
"</soap:Header>"
)
:
''
) +
"<soap:Body" +
(self.bodyAttributes ? self.bodyAttributes.join(' ') : '') +
">" +
message +
"</soap:Body>" +
"</soap:Envelope>";
I have solved the issue changing as NicolasZ said, my current soap/lib/client.js is:
line 187:
xml = "<soap:Envelope " +
//"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
"xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" " +
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
encoding +
this.wsdl.xmlnsInEnvelope + '>' +
((self.soapHeaders || self.security) ?
(
"<soap:Header>" +
(self.soapHeaders ? self.soapHeaders.join("\n") : "") +
(self.security ? self.security.toXML() : "") +
"</soap:Header>"
)
:
''
) +
"<soap:Body" +
(self.bodyAttributes ? self.bodyAttributes.join(' ') : '') +
">" +
message +
"</soap:Body>" +
"</soap:Envelope>";