diff --git a/.gitignore b/.gitignore index 6da04de..36420af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ node_modules -config.js \ No newline at end of file +config.json \ No newline at end of file diff --git a/soapClient.js b/soapClient.js index 7d589ee..0e0504e 100644 --- a/soapClient.js +++ b/soapClient.js @@ -2,12 +2,11 @@ var querystring = require("querystring"); var xml2js = require('xml2js'); var soap = require('soap'); var getXml = require('./getXml'); -var credential = require('./credential'); +var config = require('./config.json'); function soapClient(xmlFile){ - var url = 'http://services2-acc.floraholland.com/CommercialCustomer/CommercialCustomer_1p5.svc?wsdl'; - var auth = "Basic " + new Buffer(credential.user + ":" + credential.pass).toString("base64"); + var auth = "Basic " + new Buffer(config.user + ":" + config.pass).toString("base64"); var options = { wsdl_headers:{ @@ -17,13 +16,14 @@ function soapClient(xmlFile){ valueKey: '_' }; + soap.createClient(url,options, function(err, client) { if (err) { console.log(err); return; } - client.setSecurity(new soap.BasicAuthSecurity(credential.use,credential.pass)); + client.setSecurity(new soap.BasicAuthSecurity(config.user,config.pass)); console.log('no entra'); getXml.getXml(xmlFile, function(err, data) { if (err) {