Javascript 如何使用节点soap强制使用请求的显式命名空间
我正在尝试使用Javascript 如何使用节点soap强制使用请求的显式命名空间,javascript,node.js,soap,Javascript,Node.js,Soap,我正在尝试使用SOAP节点模块进行SOAP调用。我遇到的问题是,我正在联系的服务需要显式使用命名空间。以下是我如何使用该模块: var soap = require('soap') soap.createClient('./SessionService.wsdl', function (err, sessionClient) { sessionClient.LogIn({ 'Input': { 'Username': userName, '
SOAP
节点模块进行SOAP调用。我遇到的问题是,我正在联系的服务需要显式使用命名空间。以下是我如何使用该模块:
var soap = require('soap')
soap.createClient('./SessionService.wsdl', function (err, sessionClient) {
sessionClient.LogIn({
'Input': {
'Username': userName,
'Password': password
}
}, function (err, result) {
// intentionally left blank
});
});
上面的代码生成以下SOAP信封。请注意,输入、用户名和密码元素的前缀不是名称空间
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://REDACTED/v2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:q1="http://REDACTED/Service" xmlns:q2="http://REDACTED/Service" xmlns:q3="http://REDACTED/Service" xmlns:q4="http://REDACTED/Service">
<soap:Body>
<LogIn xmlns="http://REDACTED/v2">
<Input>
<Username>USERNAME</Username>
<Password>PASSWORD</Password>
</Input>
</LogIn>
</soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://REDACTED/v2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:q1="http://REDACTED/Service" xmlns:q2="http://REDACTED/Service" xmlns:q3="http://REDACTED/Service" xmlns:q4="http://REDACTED/Service">
<soap:Body>
<tns:LogIn xmlns="http://REDACTED/v2">
<tns:Input>
<q1:Username>USERNAME</q1:Username>
<q1:Password>PASSWORD</q1:Password>
</tns:Input>
</tns:LogIn>
</soap:Body>
</soap:Envelope>
var soap = require('soap')
soap.createClient('./SessionService.wsdl', function (err, sessionClient) {
sessionClient.LogIn({
'tns:Input': {
'q1:Username': userName,
'q1:Password': password
}
}, function (err, result) {
});
});