refactorizar xml
This commit is contained in:
parent
c56f437fed
commit
0d97923630
|
@ -24,4 +24,17 @@ function replaceFunc (token)
|
|||
return values[key];
|
||||
|
||||
}
|
||||
|
||||
function setXml(path,data,callback){
|
||||
|
||||
fs.writeFile(__dirname + path,data,{encoding:'utf8'},function(err){
|
||||
if (err) {
|
||||
callback(err,null);
|
||||
return;
|
||||
}
|
||||
callback(null);
|
||||
});
|
||||
}
|
||||
|
||||
exports.setXml = setXml;
|
||||
exports.getXml = getXml;
|
|
@ -1,7 +1,7 @@
|
|||
var querystring = require("querystring");
|
||||
var xml2js = require('xml2js');
|
||||
var soap = require('soap');
|
||||
var getXml = require('./getXml');
|
||||
var IOXml = require('./IOXml');
|
||||
var config = require('./config.json');
|
||||
|
||||
function soapClient(xmlFile){
|
||||
|
@ -16,7 +16,6 @@ function soapClient(xmlFile){
|
|||
valueKey: '_'
|
||||
};
|
||||
|
||||
|
||||
soap.createClient(url,options, function(err, client) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
|
@ -25,7 +24,7 @@ function soapClient(xmlFile){
|
|||
|
||||
client.setSecurity(new soap.BasicAuthSecurity(config.user,config.pass));
|
||||
console.log('no entra');
|
||||
getXml.getXml(xmlFile, function(err, data) {
|
||||
IOXml.getXml(xmlFile, function(err, data) {
|
||||
if (err) {
|
||||
console.log('err');
|
||||
console.log(err);
|
||||
|
@ -48,6 +47,11 @@ function soapClient(xmlFile){
|
|||
console.log(err.message);
|
||||
return;
|
||||
}
|
||||
var builder = new xml2js.Builder();
|
||||
var fileContent = builder.buildObject(supply);
|
||||
IOXml.setXml('/xml_buyer/supplyresponse_getall.xml',fileContent,function(){
|
||||
console.log('archivo creado');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue