风控中台-修改esb报文命名格式;由于esb外联安全升级,导致出现乱码,修改esb返回报文数据格式
This commit is contained in:
parent
06265eba14
commit
7cdbbe9f21
@ -4,7 +4,7 @@ userid=TYJWBY7F
|
||||
AFS012_serviceid=N9LZG7J8OXSD90B4
|
||||
AMP005_serviceid=24LITXVE9LKXANTD
|
||||
|
||||
log_path=D:/tmp/esb/log/
|
||||
log_path=/data/esb/log/
|
||||
|
||||
## ·´ÆÛÕ©
|
||||
afs_url=http://test-antifraud.baicfc.com/Instinct.UI.WebClient_5.3.1_2023/api/redirect?
|
||||
|
||||
@ -25,7 +25,6 @@ import org.apache.http.util.EntityUtils;
|
||||
import org.bouncycastle.crypto.digests.SM3Digest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class EsbCommon implements EsbServise {
|
||||
public Transaction createEsbTransaction() {
|
||||
@ -96,8 +95,8 @@ public class EsbCommon implements EsbServise {
|
||||
HttpResponse response = client.execute(httppost);
|
||||
if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){
|
||||
result = EntityUtils.toString(response.getEntity());
|
||||
byte[] xmlByte = result.getBytes(StandardCharsets.ISO_8859_1);
|
||||
result = new String(xmlByte,"utf-8");
|
||||
// byte[] xmlByte = result.getBytes(StandardCharsets.ISO_8859_1);
|
||||
// result = new String(xmlByte,"utf-8");
|
||||
System.out.println("ESB响应报文:\n"+result);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
@ -120,13 +119,13 @@ public class EsbCommon implements EsbServise {
|
||||
}
|
||||
@Override
|
||||
public Transaction transactionDo(){
|
||||
String logPath = BaicPropertiesUtil.get("log_path");
|
||||
//.创建实体类
|
||||
Transaction tranRequest = createEsbTransaction();
|
||||
String logPath = BaicPropertiesUtil.get("log_path")+tranRequest.getMessageEsbHead().getTranCode()+"_"+tranRequest.getMessageEsbHead().getGlobalSeqNo();
|
||||
//.转换为xml请求报文
|
||||
String xmlRrquest = XstreamUtil.xmlConvert(tranRequest);
|
||||
//.将xml请求报文存为文件
|
||||
FileUtil.writeFile(logPath+tranRequest.getMessageEsbHead().getGlobalSeqNo()+"_request.txt", xmlRrquest);
|
||||
FileUtil.writeFile(logPath + "_request.txt", xmlRrquest);
|
||||
//.保存请求信息
|
||||
saveEsbLog(tranRequest);
|
||||
//.获得url
|
||||
@ -134,7 +133,7 @@ public class EsbCommon implements EsbServise {
|
||||
//.得到响应报文
|
||||
String xmlResopnse= this.httpSend(url,xmlRrquest);
|
||||
//.将xml响应报文存为文件
|
||||
FileUtil.writeFile(logPath+tranRequest.getMessageEsbHead().getGlobalSeqNo()+"_response.txt", xmlResopnse);
|
||||
FileUtil.writeFile(logPath+"_response.txt", xmlResopnse);
|
||||
//.转换为实体类
|
||||
Transaction tranResponse = (Transaction)XstreamUtil.objectConvert(xmlResopnse);
|
||||
//.更新响应信息
|
||||
|
||||
@ -58,8 +58,10 @@ public class AfsResultServlet extends HttpServlet {
|
||||
Transaction tran = (Transaction)XstreamUtil.objectConvert(requestXml);
|
||||
String logPath = BaicPropertiesUtil.get("log_path");
|
||||
String globalSeqNo = tran.getMessageEsbHead().getGlobalSeqNo();
|
||||
String tranCode = tran.getMessageEsbHead().getTranCode();
|
||||
String projectNo = tran.getMessageBody().getAfsResultRequest().getApplyNo();
|
||||
FileUtil.writeFile(logPath + projectNo +"_"+ globalSeqNo +"_request.txt", requestXml);
|
||||
String filePath = logPath + tranCode + "_" + projectNo +"_"+ globalSeqNo;
|
||||
FileUtil.writeFile( filePath + "_request.txt", requestXml);
|
||||
String fraudAlert = tran.getMessageBody().getAfsResultRequest().getFraudAlert();
|
||||
String actionTaken = tran.getMessageBody().getAfsResultRequest().getActionTaken();
|
||||
|
||||
@ -103,7 +105,7 @@ public class AfsResultServlet extends HttpServlet {
|
||||
appHead.setTargetTranTime(DateUtils.TimeNowAccurate());
|
||||
|
||||
String responseXml = XstreamUtil.xmlConvert(tran);
|
||||
FileUtil.writeFile(logPath + projectNo +"_"+ globalSeqNo + RetCommStatus +"_response.txt", responseXml);
|
||||
FileUtil.writeFile(filePath + "_response.txt", responseXml);
|
||||
|
||||
return responseXml;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user