diff --git a/ais-structure/src/modules/helper/connection.js b/ais-structure/src/modules/helper/connection.js index 78ddd47..666d844 100644 --- a/ais-structure/src/modules/helper/connection.js +++ b/ais-structure/src/modules/helper/connection.js @@ -10,7 +10,7 @@ var moment = require('moment'); var connection = []; -connection.requestSoapToSACF = async function (req,soap,cmd,myMethod,header) { +connection.requestSoapToSACF = async function (req,soap,cmd,myMethod,headers) { try { log.log("Connect to SACF") @@ -19,7 +19,7 @@ connection.requestSoapToSACF = async function (req,soap,cmd,myMethod,header) { var params = { url : service[myMethod+"_"+cmd+"_URL"], - header : header, + headers : headers, body : messageSOAP.objectToSOAP(soap,cmd), method : myMethod, timeout : cfg.service.SACF[myMethod+"_"+cmd+"_Timeout"]*1000 diff --git a/ais-structure/src/modules/helper/messageSOAP.js b/ais-structure/src/modules/helper/messageSOAP.js index ef50143..0bc69fe 100644 --- a/ais-structure/src/modules/helper/messageSOAP.js +++ b/ais-structure/src/modules/helper/messageSOAP.js @@ -70,10 +70,12 @@ function getBodySOAP(objectData) var keyList = Object.keys(objectData); for(var i=0;i"+objectData[keyList[i]]+""; - else - body += ""+getBodySOAP(objectData[keyList[i]])+""; + if(objectData[keyList[i]]){ + if(typeof objectData[keyList[i]] != 'object') + body += ""+objectData[keyList[i]]+""; + else + body += ""+getBodySOAP(objectData[keyList[i]])+""; + } } } return body; diff --git a/ais-structure/src/modules/vizcard/vizCard.ctrl.js b/ais-structure/src/modules/vizcard/vizCard.ctrl.js index b5106e5..28be308 100644 --- a/ais-structure/src/modules/vizcard/vizCard.ctrl.js +++ b/ais-structure/src/modules/vizcard/vizCard.ctrl.js @@ -50,8 +50,10 @@ exports.vizcard = async function (req, res, next) { if(typeof result.err === 'undefined'){ + console.log(result.response.body); + try { - var resultSoap = parseJson.xml2json(result.body, {compact: true, spaces: 4}) + var resultSoap = parseJson.xml2json(result.response.body, {compact: true, spaces: 4}) resultSoap = JSON.parse(resultSoap) resultSoap = resultSoap['soap:Envelope']['soap:Body']['tem:SearchCustomerResponse']['tem:SearchCustomerResult']['tem:CustomerSearchResult']; -- libgit2 0.21.2