ช่วงนี้ได้มาพัฒนาระบบบน MediationZone เต็มตัว ใครที่หลงเข้ามาอ่านหวังว่าจะได้ความรู้ที่ผม note ไว้ อาจงงๆหน่อยนะ 555 #mz
ส่วนประกอบในไฟล์ APL
//common import
import ultra.CBS.UFL_DSP_Header; import ultra.CBS.UFL_MBASE_Header; import apl.Common.APL_Common_MBASE; import ultra.Ultra.UFL_MBASE_Reject; import apl.Common.APL_Common_Utilities;
//wsdl
import ultra.ws.CBS.PRF_WS_Name.cycles; import ultra.ws.CBS.PRF_WS_Name.tns;
//ultra
import ultra.Ultra.UFL_MBASE_AB1234;
//length
final int sizeOf_AB1234 = 1234;
//DSP Header
DSP_Header_TgIn dspHeader = createDefaultDSPHeader(); dspHeader.SKTMLEN = sizeOf_DSPHeader + sizeOf_MBaseHeader + sizeOf_AB1234 - 9; dspHeader.I13FMID = "MBASE"; dspHeader.I13DID = "DEPI"; dspHeader.I13SID = request.param_Header.ChannelID + "##"; //dspHeader.I13ACQN = uniqKey; dspHeader.I13ACQN = strSubstring(uniqKey, 0, 12); dspHeader.I13TMNO = strSubstring(uniqKey, 12, 16);
//MBASE Header
MBASE_Header_TI mbaseHeader = createDefaultMBASEHeader(); mbaseHeader.HDTCOD = "AB1234"; mbaseHeader.HDDSID = request.param_Header.ChannelID; // ESB mbaseHeader.HDACCD = "I"; //Action > A C D I > Add Change Delete mbaseHeader.HDNREC = "1"; // record max 20 mbaseHeader.HDUSID = request.param_Header.ChannelID + "USR"; if (VariableFormat != ""){ mbaseHeader.HDMREC = "Y"; mbaseHeader.HDVFMT = VariableFormat; }
//Request Data
การใช้งาน MBASE Request Data กับประเภท type ต่างๆ
string mbaseRequest.xx_xxxxx = request.param_Data.xxxxx; //string long mbaseRequest.xx_xxxxx = padding((string)request.param_Data.xxxxx, 5, "right", "0"); //long date dateToString(mbaseRequest.xx_xxxxx, request.param_Data.xxxxx, "yyyyMMdd"); //ddMMyyy //yyyyMMdd
//Build Socket Message
aaa
//Response Header
aaa
//Response StatusInfo
aaa
//Request Data
aaa
//Response Content
การใช้งาน MBASE response content กับประเภท type ต่างๆ
date strToDate(mz.xxxx, getStringValue(mzgen.xx_xxxxx), "yyyyMMdd", "GMT+7"); //date decimal strToDouble(mz.xxxx,convertToNumberic(mzgen.xx_xxxxx, 17, 2)); //decimal string mz.xxxx = getStringValue(mzgen.xx_xxxxx); //string int strToInt(mz.xxxx ,getStringValue(mzgen.xx_xxxxx)); //int long strToLong(mz.xxxxx,getStringValue(mzgen.xx_xxxxx)); //long
//Response Status Info
aaa
//Response Header
aaa
//ปัญหาเรื่องของเวลาที่เจอบ่อย
strToDate(acco.xxx,getStringValue(account.ABC_XXX), "HHmmss", "GMT+7"); // (static_size6) strToDate(acco.xxx,getStringValue(account.ABC_XXX), "yyyyMMdd HHmmss", "GMT+7"); //(static_size26) strToDate(acco.xxx, strSubstring(getStringValue(account.ABC_XXX),0,23), "yyyy-MM-dd-HH.mm.ss.SSS", "GMT+7"); // (static_size26) strToDate(acco.xxx,getStringValue(account.ABC_XXX), "yyyyMMdd", "GMT+7"); //(static_size8) // for Timestamp //edit ultra, apl, wsdl
---------------------------------------
UFL เป็นการประกาศสร้าง MBASE (Field) เพื่อนำมาใช้งานในระบบ
การประกาศค่าตัวแปรบน MZ
เช่น String 10 ascii ABC_Name : static_size(1),character_encoding("cp838"),padded_with(0x40),align(left); //x เช่่น long 10.0 ascii ABC_Name : static_size(1),character_encoding("cp838"),padded_with(0xf0),align(right); //x.0 เช่น decimal 17.2 ascii ABC_Name : static_size(11),character_encoding("cp838"); // x.x
ปัญหาต่างๆ ที่เกิดขึ้นจาก UFL
issue ปัญหาที่ 400 ไม่สามารถรับ message ได้ ทำให้ error ส่วนมากจะมาจาก encoding ตั้งค่าผิดเช่น //ascii LNPWFZ_FreezeFlag : static_size(1),character_encoding("cp838"); //edit data not send 400 error //ascii LNPWFZ_FreezeFlag : static_size(1),character_encoding("cp838"),padded_with(0x40),align(left); //x
ปัญหาทำการ Request แบบ List ไปที่ CBS (AS400) แล้วเกิด Error AB (RNX0100)
<ResponseMessage>Handler Hit Error, Contact IT !(XXX-Length or start position is out of range for the string operation.)</ResponseMessage>
ด้วย list นี้มีจำนวณ length เยอะ และระบบ สามารถ return กลับได้แค่ ประมาณ 9500 เลย ต้องลดจำนวณ max record ลง
---------------------------------------
---------------------------------------
---------------------------------------
---------------------------------------
เราสามารถกำหนดได้ใน Mendix ตอนที่ทำ WSDL ได้เลย โดยเลือกรายการที่ Nillable ดังรูป จะเห็นได้ว่ารูปที่ 2 มีการดึงค่า NULL มาแสดงด้วย
---------------------------------------
---------------------------------------
---------------------------------------
Main Router reject
<ResponseMessage>Invalid Transaction Code ABC1234 -Main Router reject !!!</ResponseMessage>
เกิดจากอะไร แก้ไขอย่างไร ... เกิดจาก dspHeader ส่งค่าเข้าไป as400 ไม่ถูกต้อง ลองเช็คดูว่าเค้าให้ส่งค่าอะไร Destination ID: ?, Action: ?
---------------------------------------
---------------------------------------