Commit 1b5ca11b2571097799565b8dc9519c8943c754f3
1 parent
a7a5d7d4
Exists in
master
and in
1 other branch
update vizcard
Showing
3 changed files
with
11 additions
and
7 deletions
Show diff stats
ais-structure/src/modules/helper/connection.js
| @@ -10,7 +10,7 @@ var moment = require('moment'); | @@ -10,7 +10,7 @@ var moment = require('moment'); | ||
| 10 | var connection = []; | 10 | var connection = []; |
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | -connection.requestSoapToSACF = async function (req,soap,cmd,myMethod,header) { | 13 | +connection.requestSoapToSACF = async function (req,soap,cmd,myMethod,headers) { |
| 14 | try { | 14 | try { |
| 15 | log.log("Connect to SACF") | 15 | log.log("Connect to SACF") |
| 16 | 16 | ||
| @@ -19,7 +19,7 @@ connection.requestSoapToSACF = async function (req,soap,cmd,myMethod,header) { | @@ -19,7 +19,7 @@ connection.requestSoapToSACF = async function (req,soap,cmd,myMethod,header) { | ||
| 19 | 19 | ||
| 20 | var params = { | 20 | var params = { |
| 21 | url : service[myMethod+"_"+cmd+"_URL"], | 21 | url : service[myMethod+"_"+cmd+"_URL"], |
| 22 | - header : header, | 22 | + headers : headers, |
| 23 | body : messageSOAP.objectToSOAP(soap,cmd), | 23 | body : messageSOAP.objectToSOAP(soap,cmd), |
| 24 | method : myMethod, | 24 | method : myMethod, |
| 25 | timeout : cfg.service.SACF[myMethod+"_"+cmd+"_Timeout"]*1000 | 25 | timeout : cfg.service.SACF[myMethod+"_"+cmd+"_Timeout"]*1000 |
ais-structure/src/modules/helper/messageSOAP.js
| @@ -70,10 +70,12 @@ function getBodySOAP(objectData) | @@ -70,10 +70,12 @@ function getBodySOAP(objectData) | ||
| 70 | var keyList = Object.keys(objectData); | 70 | var keyList = Object.keys(objectData); |
| 71 | for(var i=0;i<keyList.length;i++) | 71 | for(var i=0;i<keyList.length;i++) |
| 72 | { | 72 | { |
| 73 | - if(typeof objectData[keyList[i]] != 'object') | ||
| 74 | - body += "<tem:"+keyList[i]+">"+objectData[keyList[i]]+"</tem:"+keyList[i]+">"; | ||
| 75 | - else | ||
| 76 | - body += "<tem:"+keyList[i]+">"+getBodySOAP(objectData[keyList[i]])+"</tem:"+keyList[i]+">"; | 73 | + if(objectData[keyList[i]]){ |
| 74 | + if(typeof objectData[keyList[i]] != 'object') | ||
| 75 | + body += "<tem:"+keyList[i]+">"+objectData[keyList[i]]+"</tem:"+keyList[i]+">"; | ||
| 76 | + else | ||
| 77 | + body += "<tem:"+keyList[i]+">"+getBodySOAP(objectData[keyList[i]])+"</tem:"+keyList[i]+">"; | ||
| 78 | + } | ||
| 77 | } | 79 | } |
| 78 | } | 80 | } |
| 79 | return body; | 81 | return body; |
ais-structure/src/modules/vizcard/vizCard.ctrl.js
| @@ -50,8 +50,10 @@ exports.vizcard = async function (req, res, next) { | @@ -50,8 +50,10 @@ exports.vizcard = async function (req, res, next) { | ||
| 50 | 50 | ||
| 51 | if(typeof result.err === 'undefined'){ | 51 | if(typeof result.err === 'undefined'){ |
| 52 | 52 | ||
| 53 | + console.log(result.response.body); | ||
| 54 | + | ||
| 53 | try { | 55 | try { |
| 54 | - var resultSoap = parseJson.xml2json(result.body, {compact: true, spaces: 4}) | 56 | + var resultSoap = parseJson.xml2json(result.response.body, {compact: true, spaces: 4}) |
| 55 | resultSoap = JSON.parse(resultSoap) | 57 | resultSoap = JSON.parse(resultSoap) |
| 56 | resultSoap = resultSoap['soap:Envelope']['soap:Body']['tem:SearchCustomerResponse']['tem:SearchCustomerResult']['tem:CustomerSearchResult']; | 58 | resultSoap = resultSoap['soap:Envelope']['soap:Body']['tem:SearchCustomerResponse']['tem:SearchCustomerResult']['tem:CustomerSearchResult']; |
| 57 | 59 |