我正在使用这个npm-模块:https://github.com/vpulim/node-soap
我想要使用的and服务仅使用SOAP1.2,并在使用任何其他SOAP版本时返回一个服务器错误。
是否有人经历过同样的问题,并且知道如何设置SOAP版本?
发布于 2015-03-08 23:40:57
您可以进入soap\lib\client.js到第186行并修改信封语法,以便它符合SOAP1.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>";发布于 2015-12-11 09:38:11
使用最新版本的https://github.com/vpulim/node-soap,可以选择设置SOAP1.2头
var options = {
forceSoap12Headers: true
};
soap.createClient(url,options, function (err, client) {
//Your soap call here
}); 海事组织,我认为我们不应该修改库,这对升级没有好处。
发布于 2015-03-19 23:27:08
正如NicolasZ所说,我已经解决了这个问题,我当前的soap/lib/client.js是:
第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>";https://stackoverflow.com/questions/24934973
复制相似问题