2016-12-12 4 views
1

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> 

Как я могу это сделать?

ответ

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

Измените Арг может иметь тот же результат