Commit a7a5d7d464351976c44f041d8efb3131ca4f7497

Authored by Nattapon Wongpaet
1 parent 1e902124
Exists in master and in 1 other branch dev

get header

ais-structure/src/modules/helper/connection.js
... ... @@ -10,7 +10,7 @@ var moment = require('moment');
10 10 var connection = [];
11 11  
12 12  
13   -connection.requestSoapToSACF = async function (req,soap,cmd,myMethod) {
  13 +connection.requestSoapToSACF = async function (req,soap,cmd,myMethod,header) {
14 14 try {
15 15 log.log("Connect to SACF")
16 16  
... ... @@ -19,6 +19,7 @@ connection.requestSoapToSACF = async function (req,soap,cmd,myMethod) {
19 19  
20 20 var params = {
21 21 url : service[myMethod+"_"+cmd+"_URL"],
  22 + header : header,
22 23 body : messageSOAP.objectToSOAP(soap,cmd),
23 24 method : myMethod,
24 25 timeout : cfg.service.SACF[myMethod+"_"+cmd+"_Timeout"]*1000
... ...
ais-structure/src/modules/vizcard/vizCard.ctrl.js
... ... @@ -14,10 +14,7 @@ exports.vizcard = async function (req, res, next) {
14 14 var sacf = "SACF";
15 15 var method = constant.METHOD.GET;
16 16  
17   - if(req.query.clientName && req.query.commandId){
18   - var customerId = req.query.clientName+"@"+req.query.commandId;
19   - }
20   - log.startlog(req,method+"_"+getCmd,req.query.commandId,customerId);
  17 + log.startlog(req,method+"_"+getCmd,req.query.commandId,req.query.commandId);
21 18 log.logDetail.addInput(req,req.query.clientName,method+"_"+getCmd,constant.REQUEST,req,req.body);
22 19  
23 20 var err = await validator(req,getCmd);
... ... @@ -43,7 +40,12 @@ exports.vizcard = async function (req, res, next) {
43 40 moblieNo : req.query.moblieNo
44 41 };
45 42  
46   - const result = await connection.requestSoapToSACF(req,objectData,sendCmd,constant.METHOD.POST);
  43 + var objHeader = {
  44 + 'X-Redirect-Url' : 'http://spwcdxtst.spwg.local:6300/hPGService/hpGVizOnline/CustomerService.asmx',
  45 + 'X-Session-Id' : req.get('X-Session-Id')
  46 + }
  47 +
  48 + const result = await connection.requestSoapToSACF(req,objectData,sendCmd,constant.METHOD.POST,objHeader);
47 49 // console.log(result.err)
48 50  
49 51 if(typeof result.err === 'undefined'){
... ...