node.js - node-soap 更改操作的命名空间

标签 node.js soap node-soap

以下代码中的

client.lastRequest 是:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
           xmlns:urn="urn:services.example.com/">
<soap:Body>
    <getImagesDefinition>
        <Input>0001386669</Input>
    <getImagesDefinition/>
</soap:Body>

这是源代码:

    var soap = require('soap');
    var url = 'http://www.example.com?sap-client=080';
    var args = { INPUT: '0001386669' };
    var auth = "Basic " + new Buffer("username" + ":" + "password").toString("base64");

    soap.createClient(url, { wsdl_headers: { Authorization: auth } }, function (err, client) {
        client.setSecurity(new soap.BasicAuthSecurity('admin', 'password'));
        client.getImagesDefinition(args, function(err, result){
            //console.log(err);
            //console.log(result);
        });
        console.log(client.lastRequest);
    });

我想要的请求应该是:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
           xmlns:urn="urn:services.example.com/">
<soap:Body>
    <urn:getImagesDefinition>
        <Input>0001386669</Input>
    <urn:getImagesDefinition/>
</soap:Body>

我怎样才能做到这一点?

最佳答案

var args = {
    attributes:{
        'xmlns':"urn:services.example.com"
    },
    'INPUT': '0001386669'
};

更改参数可能会得到相同的结果

关于node.js - node-soap 更改操作的命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41102069/

相关文章:

node.js - Node SOAP ClientSSLSecurityPFX - 403 禁止

node.js - 将8kHz mulaw转换为PCM 16kHz

node.js - oclif 无法识别创建的命令

php - 如何使用 XML 创建包含 CDATA 的 SoapVar?

javascript - 在 Express 中监听 SOAP 请求

javascript - 当响应字段包含一个子项时,node-soap 强制数组

javascript - 在 chrome 开发工具中调试本地 nodejs 脚本

javascript - 如何从 forEach 调用一些全局变量

ASP.NET 中 MSSOAP.SoapClient30 的 PHP 替代方案

java - RESTful 服务客户端可以作为 SOAP 服务的服务器吗?