PeopleSoft-PS对外提供接口

REST接口

设置系统监听

创建消息

请求消息

响应消息

创建服务

创建服务操作

  • 常规设置
  • 处理程序设置

编写处理方法代码

common类 —— 日志类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class Common
/*申明构造方法*/
method Common();
/*声明类的方法*/
method AddRequestJsonLog(&strOaApplyNum As string, &strApplyId As string, &objRequestJson As JsonObject);
private
/*申明私有session*/
instance ApiObject &oSession;
end-class;

/*定义构造方法*/
method Common
end-method;

/*定义类的方法*/
method AddRequestJsonLog
/+ &strOaApplyNum as String, +/
/+ &strApplyId as String, +/
/+ &objRequestJson as JsonObject +/
/*
入参:&strOaApplyNum -- OA申请单号;
&strApplyId -- PS申请单号;
&objRequestJson -- 请求信息json对象;
*/
/*获取日志表record*/
Local Record &reApplyLog = CreateRecord(Record.C_APPLY_LOG);
&reApplyLog.C_OA_APPL_NUM.Value = &strOaApplyNum;
&reApplyLog.C_APPLY_ID.Value = &strApplyId;
/*根据key值找记录,找到就进行修改*/
If &reApplyLog.SelectByKey() Then
&reApplyLog.C_REQ_JSON.Value = &objRequestJson.ToString();
/*更新表*/
&reApplyLog.Update();
End-If;
end-method;

MedResult类 —— 入口类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*导入需要的包,其中IRequestHandler 为PS监听器包*/
import PS_PT:Integration:IRequestHandler;
import C_INTERFACE_MGR:C_PERSONNEL_MGR:MedResult:Applicant;
import C_COMMON_FUNC:COMMON;
import C_INTERFACE_MGR:COMMON:Common;

class MedResult implements PS_PT:Integration:IRequestHandler
/*声明构造方法*/
method MedResult();
/*申明入口方法*/
method OnRequest(&MSG As Message) Returns Message;
/*申明用人需求数据写入的调用方法*/
rem 用人需求数据写入;
method OnRequestMedResult(&MSG As Message) Returns Message;
end-class;

/*定义构造方法*/
method MedResult
end-method;

/*定义入口方法*/
method OnRequest
/+ &MSG as Message +/
/+ Returns Message +/
/+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/
Local Message &ResMsg;
Local number &URIResourceIndex = &MSG.URIResourceIndex;
/*当URIResourceIndex = 1 时,即前面说的,把服务操作的URI模板设置为问号 ? 的情况*/
If &URIResourceIndex = 1 Then
Return %This.OnRequestMedResult(&MSG);
End-If;
end-method;

/*定义用人需求数据写入的调用方法*/
rem 用人需求数据写入;
method OnRequestMedResult
/+ &MSG as Message +/
/+ Returns Message +/

Local Message &ResMsg;
Local string &strResultMsg;

/*获取入参报文*/
Local string &requestJsonString = &MSG.GetContentString();

/*解析Json*/
Local JsonParser &JsonParser = CreateJsonParser();
Local boolean &JsonParserStatus = &JsonParser.Parse(&requestJsonString);
If &JsonParserStatus = False Then
throw CreateException(10003, - 1, "Json解析错误");
End-If;

/*取请求报文参数*/
Local JsonObject &jObj = &JsonParser.GetRootObject();
Local string &strOaApplyNum = &jObj.GetProperty("C_APP_SEQ");

/*获取处理类的对象,将解析后的json对象传入*/
Local C_INTERFACE_MGR:C_PERSONNEL_MGR:MedResult:Applicant &Applicant = create C_INTERFACE_MGR:C_PERSONNEL_MGR:MedResult:Applicant();
Local boolean &boolResult = &Applicant.addMedResult(&jObj);

/*生成响应报文*/
Local JsonObject &jObjResRoot = CreateJsonObject();
Local JsonObject &jObjResRoot2 = CreateJsonObject();

If &boolResult = True Then
&jObjResRoot.AddJsonObject("C_BAS_INFO_RES", &jObjResRoot2);
&jObjResRoot2.AddProperty("RESULTCODE", 1);
&jObjResRoot2.AddProperty("RESULTMSG", "");
&jObjResRoot2.AddProperty("TIME", %Datetime);
Else
&jObjResRoot.AddJsonObject("C_BAS_INFO_RES", &jObjResRoot2);
&jObjResRoot2.AddProperty("RESULTCODE", 0);
rem 获取错误信息;
SQLExec("SELECT AL.DESCRLONG FROM PS_C_APPLY_LOG AL WHERE AL.C_OA_APPL_NUM = :1 AND AL.C_APPLY_ID = :2", &strOaApplyNum, "medresult", &strResultMsg);
&jObjResRoot2.AddProperty("RESULTMSG", &strResultMsg);
&jObjResRoot2.AddProperty("TIME", %Datetime);
End-If;

/*获取公共类的日志类的对象,将OA申请单号,参数,json对象传入 */
Local C_INTERFACE_MGR:COMMON:Common &addRequestJsonLog = create C_INTERFACE_MGR:COMMON:Common();
&addRequestJsonLog.AddRequestJsonLog(&strOaApplyNum, "medresult", &jObj);

/*生成响应报文*/
Local string &responseJsonString = &jObjResRoot.ToString();

Local Message &responseMessage = CreateMessage(@("Operation." | &MSG.OperationName), %IntBroker_Response);

Local boolean &bRet = &responseMessage.SetContentString(&responseJsonString);

Return &responseMessage;

end-method;

Applicant类 —— 处理类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
class Applicant
/*申明构造方法*/
method Applicant();
/*申明离职数据写入方法*/
method addMedResult(&ApplicantJsonObj As JsonObject) Returns boolean;
/*声明错误捕获方法*/
method errorHandler(&strC_APP_SEQ As string, &strEMPLID As string);
/*声明日志表更新方法*/
method updateErrorLogTable(&strC_APP_SEQ As string, &strEMPLID As string, &_errMsgText As string);
private
/*声明私session*/
instance ApiObject &oSession;
end-class;

/*定义构造方法*/
method Applicant
&oSession = GetSession();
&oSession.connect(1, "", "POSTDATA", "", 0);
SetLanguage("ZHS");
&oSession.PSMessagesMode = 1;
end-method;

/*
功能:定义离职数据写入方法
入参:&ApplicantJsonObj -- json对象;
回参:boolean值;
*/
method addMedResult
/+ &ApplicantJsonObj as JsonObject +/
/+ Returns Boolean +/
/*定义CI使用到的变量*/
Local ApiObject &oCEmplDemandComCi;
Local ApiObject &oCWflPrcsVwCollection, &oCWflPrcsVw;
Local ApiObject &oCEmplDemandSCollection, &oCEmplDemandS;
/*定义变量*/
Local string &strC_APP_SEQ, &strC_APP_DT, &strEMPLID, &NAME, &strC_APPLI_RS, &DEPTID, &DESCR, &strEMPLID2, &NAME2, &DEPTID1, &strDESCR254;
Local string &strC_RE_NO, &strC_APPLI_LEVEL, &strPOSITION_NBR, &strC_POSN_GRDE_ID, &strC_DEMAND_NUM, &strEMPLID_ASSIGN_BY, &strC_PRO_PRD_DT, &strDESCR_0;
Local date &APP_DATE, &PRO_PRD_DATE;

/*定义日志文件*/
Local File &fileLog;
&fileLog = GetFile("/file/C_MED_RESULT.log", "A", "A", %FilePath_Absolute);
&fileLog.WriteLine("********* 时间:" | %Date | " ******");
&fileLog.WriteLine("********* Begin C_MED_RESULT ******");

try
/*校验申请单号重复性*/
Local string &isExitFlag = " ";
Local string &ERR = "";
&strC_APP_SEQ = &ApplicantJsonObj.GetProperty("C_APP_SEQ");
SQLExec(" SELECT 'X' from PS_C_EMPL_DEMAND_T t WHERE t.c_section_type = '1000000002' AND t.C_APP_SEQ = :1 ", &strC_APP_SEQ, &isExitFlag);
/*申请单号未重复,进入处理*/
If &isExitFlag <> "X" Then
/* 从json获取用人需求数据; */
&strC_APP_DT = &ApplicantJsonObj.GetProperty("C_APP_DT");
&strC_APPLI_RS = &ApplicantJsonObj.GetProperty("C_APPLI_RS");
&strEMPLID = &ApplicantJsonObj.GetProperty("EMPLID");
&fileLog.WriteLine("&strEMPLID --- " | &strEMPLID);
SQLExec("select NAME , DEPTID, DESCR1 FROM PS_C_JOB_CURR_V WHERE EMPLID = :1 ", &strEMPLID, &NAME, &DEPTID, &DESCR);
&strEMPLID2 = &ApplicantJsonObj.GetProperty("EMPLID2");
&strDESCR254 = &ApplicantJsonObj.GetProperty("DESCR254");

/* json数据写入日志记录 */
&fileLog.WriteLine("********* Begin JOSNDATA ******");
&fileLog.WriteLine("&strC_APP_SEQ --- " | &strC_APP_SEQ);
&fileLog.WriteLine("&strC_APP_DT --- " | &strC_APP_DT);
&fileLog.WriteLine("&strC_APPLI_RS --- " | &strC_APPLI_RS);
&fileLog.WriteLine("&strEMPLID --- " | &strEMPLID);
&fileLog.WriteLine("&NAME --- " | &NAME);
&fileLog.WriteLine("&DEPTID --- " | &DEPTID);
&fileLog.WriteLine("&DESCR --- " | &DESCR);
&fileLog.WriteLine("&strEMPLID2 --- " | &strEMPLID2);
&fileLog.WriteLine("&strDESCR254 --- " | &strDESCR254);

/*校验必填项时否缺失*/
If All(&strC_APP_SEQ, &strC_APP_DT, &strC_APPLI_RS, &strEMPLID, &strEMPLID2) Then
/*审批单号校验*/
If Len(&strC_APP_SEQ) > 10 Then
&ERR = &ERR | " 审批单号不正确,请检查数据正确性! ";
End-If;
/*申请日期校验*/
If Len(&strC_APP_DT) > 10 Then
&ERR = &ERR | " 申请日期格式不正确,请检查数据正确性! ";
End-If;
/*人申请人编码*/
&isExitFlag = " ";
SQLExec("SELECT 'X' from ps_C_PERS_SRCH_VW WHERE OPRID = 'POSTDATA' AND EMPLID = :1 ", &strEMPLID, &isExitFlag);
If &isExitFlag <> "X" Then
&ERR = &ERR | " 申请人编码不存在,请检查数据正确性! ";
End-If;
/*招聘组长编码*/
&isExitFlag = " ";
SQLExec("SELECT 'X' from ps_C_PERS_SRCH_VW WHERE OPRID = 'POSTDATA' AND EMPLID = :1 ", &strEMPLID2, &isExitFlag);
If &isExitFlag <> "X" Then
&ERR = &ERR | " 招聘组长编码不存在,请检查数据正确性! ";
End-If;
/*申请原因说明校验*/
If Len(&strDESCR254) > 254 Then
&ERR = &ERR | " 申请原因说明超长,请检查数据正确性! ";
End-If;
/*无错误信息,进入调用CI赋值处理*/
If None(&ERR) Then
/*获取CI*/
&oCEmplDemandComCi = &oSession.GetCompIntfc(CompIntfc.C_EMPL_DEMAND_COM_CI);
If &oCEmplDemandComCi = Null Then
%This.errorHandler(&strC_APP_SEQ, &strEMPLID);
Return False;
End-If;
/*设置CI交互模式*/
&oCEmplDemandComCi.InteractiveMode = False;
&oCEmplDemandComCi.GetHistoryItems = True;
&oCEmplDemandComCi.EditHistoryItems = True;


&oCEmplDemandComCi.C_APP_SEQ = &strC_APP_SEQ;
/*根据key值创建CI对象*/
If Not &oCEmplDemandComCi.Create() Then;
/*创建失败的话,调用日志方法,传入申请单号和员工ID*/
%This.errorHandler(&strC_APP_SEQ, &strEMPLID);
Return False;
End-If;

/*对CI对象中的properties赋值*/
&oCEmplDemandComCi.C_APP_SEQ = &strC_APP_SEQ;
&oCEmplDemandComCi.C_APPLI_RS = &strC_APPLI_RS;
SQLExec(" SELECT TO_DATE(:1 ,'YYYY-MM-DD') from DUAL ", &strC_APP_DT, &APP_DATE);
&oCEmplDemandComCi.C_APP_DT = &APP_DATE;
&oCEmplDemandComCi.EMPLID = &strEMPLID;
&oCEmplDemandComCi.NAME = &NAME;
&oCEmplDemandComCi.DEPTID = &DEPTID;
&oCEmplDemandComCi.DESCR = &DESCR;
&oCEmplDemandComCi.EMPLID2 = &strEMPLID2;
&oCEmplDemandComCi.DESCR254 = &strDESCR254;
rem &oCEmplDemandComCi.COUNT1 = &strCOUNT1;

/*获取json 对象的数组*/
Local JsonArray &jObApplyDataArray = &ApplicantJsonObj.GetJsonArray("LINES");

/*循环对CI对象中的元素新增并且赋值*/
&oCEmplDemandSCollection = &oCEmplDemandComCi.C_EMPL_DEMAND_S;
Local integer &i;
For &i = 1 To &jObApplyDataArray.Length();
Local JsonObject &jObApplyDataInfo = &jObApplyDataArray.GetJsonObject(&i);
/*获取第一个元素,这是由于该CI对象默认存在一个空的元素,造成的原因可能是因为对应的表中有默认值*/
&oCEmplDemandS = &oCEmplDemandSCollection.Item(1);
/*如果第一个元素的某个properties已经有值了,那么新插入一个元素*/
If All(&oCEmplDemandS.C_APPLI_LEVEL) Then
&oCEmplDemandS = &oCEmplDemandSCollection.InsertItem(1);
End-If;
/*循环获取json对象中的数组对象进行赋值*/
&strC_RE_NO = &jObApplyDataInfo.GetProperty("C_RE_NO");
&strC_APPLI_LEVEL = &jObApplyDataInfo.GetProperty("C_APPLI_LEVEL");
&strPOSITION_NBR = &jObApplyDataInfo.GetProperty("POSITION_NBR");
&strC_POSN_GRDE_ID = &jObApplyDataInfo.GetProperty("C_POSN_GRDE_ID");
&strC_DEMAND_NUM = &jObApplyDataInfo.GetProperty("C_DEMAND_NUM");
&strEMPLID_ASSIGN_BY = &jObApplyDataInfo.GetProperty("EMPLID_ASSIGN_BY");
&strC_PRO_PRD_DT = &jObApplyDataInfo.GetProperty("C_PRO_PRD_DT");
&strDESCR_0 = &jObApplyDataInfo.GetProperty("DESCR");

/*json数据写入日志记录*/
&fileLog.WriteLine("********* begin 第 " | &i | " 个json对象 ******");
rem &fileLog.WriteLine("ABSW_SEQ_NO --- " | &strABSW_SEQ_NO);
&fileLog.WriteLine("C_RE_NO --- " | &strC_RE_NO);
&fileLog.WriteLine("C_APPLI_LEVEL --- " | &strC_APPLI_LEVEL);
&fileLog.WriteLine("POSITION_NBR --- " | &strPOSITION_NBR);
&fileLog.WriteLine("C_POSN_GRDE_ID --- " | &strC_POSN_GRDE_ID);
&fileLog.WriteLine("C_DEMAND_NUM --- " | &strC_DEMAND_NUM);
&fileLog.WriteLine("EMPLID_ASSIGN_BY --- " | &strEMPLID_ASSIGN_BY);
&fileLog.WriteLine("C_PRO_PRD_DT --- " | &strC_PRO_PRD_DT);
&fileLog.WriteLine("DESCR --- " | &strDESCR_0);

/*校验子表数据*/
If All(&strC_APPLI_LEVEL, &strPOSITION_NBR, &strC_PRO_PRD_DT, &strC_POSN_GRDE_ID, &strC_RE_NO) Then

/*序号校验*/
<* If Len(&strABSW_SEQ_NO) > 2 Then
&ERR = &ERR | " 序号超长,请检查数据正确性! ";
End-If; *>
/*招聘编号校验*/
If Len(&strC_RE_NO) > 30 Then
&ERR = &ERR | " 招聘编号超长,请检查数据正确性! ";
End-If;
/*紧急程度校验*/
If Len(&strC_APPLI_LEVEL) > 2 Then
&ERR = &ERR | " 紧急程度超长,请检查数据正确性! ";
End-If;
/*岗位编号校验*/
If Len(&strPOSITION_NBR) > 8 Then
&ERR = &ERR | " 岗位编号超长,请检查数据正确性! ";
End-If;
/*职级编码校验*/
If Len(&strC_POSN_GRDE_ID) > 5 Then
&ERR = &ERR | " 职级编码超长,请检查数据正确性! ";
End-If;
/*需求人数校验*/
If Len(&strC_DEMAND_NUM) > 3 Then
&ERR = &ERR | " 需求人数超长,请检查数据正确性! ";
End-If;
/*期望到岗日期校验*/
If Len(&strC_PRO_PRD_DT) > 10 Then
&ERR = &ERR | " 期望到岗日期格式错误,请检查数据正确性! ";
End-If;
/*招聘组长校验*/
If Len(&strEMPLID_ASSIGN_BY) > 11 Then
&ERR = &ERR | " 招聘组长超长,请检查数据正确性! ";
End-If;
/*其他补充要求校验*/
If Len(&strC_PRO_PRD_DT) > 30 Then
&ERR = &ERR | " 其他补充要求超长,请检查数据正确性! ";
End-If;

/*对元素的properties赋值*/
&oCEmplDemandS.C_RE_NO = &strC_RE_NO;;
&oCEmplDemandS.C_APPLI_LEVEL = &strC_APPLI_LEVEL;;
&oCEmplDemandS.POSITION_NBR = &strPOSITION_NBR;;
&oCEmplDemandS.C_POSN_GRDE_ID = &strC_POSN_GRDE_ID;;
&oCEmplDemandS.C_DEMAND_NUM = &strC_DEMAND_NUM;;
&oCEmplDemandS.EMPLID_ASSIGN_BY = &strEMPLID_ASSIGN_BY;;
SQLExec(" SELECT TO_DATE(:1 ,'YYYY-MM-DD') from DUAL ", &strC_PRO_PRD_DT, &PRO_PRD_DATE);
&oCEmplDemandS.C_PRO_PRD_DT = &PRO_PRD_DATE;
&oCEmplDemandS.DESCR_0 = &strDESCR_0;
Else
%This.updateErrorLogTable(&strC_APP_SEQ, &strEMPLID, "必填项为空,请检查数据正确性!");
Return False;
End-If;
&fileLog.WriteLine("********* End 第 " | &i | " 个json对象 ******");
End-For;
&fileLog.WriteLine("********* End JOSNDATA ******");

/*如果无报错信息,则保存CI*/
If None(&ERR) Then
If Not &oCEmplDemandComCi.Save() Then
%This.errorHandler(&strC_APP_SEQ, &strEMPLID);
Return False;
Else
/*如果保存成功,则记录日志*/
Local Record &reApplyLog = CreateRecord(Record.C_APPLY_LOG);
&reApplyLog.C_OA_APPL_NUM.Value = &strC_APP_SEQ;
&reApplyLog.C_APPLY_ID.Value = "medresult";
/*如果已经有了记录,则更新,否则就新增*/
If Not &reApplyLog.SelectByKey() Then
&reApplyLog.C_OA_APPL_NUM.Value = &strC_APP_SEQ;
&reApplyLog.C_APPLY_ID.Value = "medresult";
&reApplyLog.EMPLID.Value = &strEMPLID;
&reApplyLog.C_APPLY_DESCR.Value = "用人需求数据写入";
&reApplyLog.C_INTERFACE_STATUS.Value = "S";
&reApplyLog.DESCRLONG.Value = "成功";
&reApplyLog.LASTUPDDTTM.Value = %Datetime;
&reApplyLog.Insert();
Else
&reApplyLog.EMPLID.Value = &strEMPLID;
&reApplyLog.C_APPLY_DESCR.Value = "用人需求数据写入";
&reApplyLog.C_INTERFACE_STATUS.Value = "S";
&reApplyLog.DESCRLONG.Value = "成功";
&reApplyLog.LASTUPDDTTM.Value = %Datetime;
&reApplyLog.Update();
End-If;
Return True;
End-If;
Else
/*保存失败的话,调用日志方法记录日志*/
%This.updateErrorLogTable(&strC_APP_SEQ, &strEMPLID, &ERR);
Return False;
End-If;
Else
/*未通过头表字段校验,调用日志方法记录日志*/
%This.updateErrorLogTable(&strC_APP_SEQ, &strEMPLID, &ERR);
Return False;
End-If;
Else
%This.updateErrorLogTable(&strC_APP_SEQ, &strEMPLID, "必填项为空,请检查数据正确性!");
Return False;
End-If;
Else
%This.updateErrorLogTable(&strC_APP_SEQ, &strEMPLID, "审批单号重复,请检查数据正确性!");
Return False;
End-If;
&fileLog.WriteLine("********* End C_MED_RESULT ******");
catch Exception &ex
%This.updateErrorLogTable(&strC_APP_SEQ, &strEMPLID, &ex.ToString());
Return False;
end-try;

end-method;



/*定义错误捕捉方法*/
method errorHandler
/+ &strC_APP_SEQ as String, +/
/+ &strEMPLID as String +/
Local string &sErrText;
Local ApiObject &oPSMessageCollection, &oPSMessage;
Local number &i;
Local string &sErrMsgSetNum, &sErrMsgNum, &sErrMsgText, &sErrType;

&oPSMessageCollection = &oSession.PSMessages;

For &i = 1 To &oPSMessageCollection.Count
&oPSMessage = &oPSMessageCollection.Item(&i);
&sErrMsgSetNum = &oPSMessage.MessageSetNumber;
&sErrMsgNum = &oPSMessage.MessageNumber;
&sErrMsgText = &oPSMessage.Text;

If &oPSMessage.Type = 1 Then
&sErrMsgText = &oPSMessage.Text;
/* find name of field in error */
Local string &SOURCE = &oPSMessage.Source;
Local number &LEN = Len(&SOURCE);
/* find last dot before field */
Local boolean &FIND = False;
Local number &START = Find(".", &SOURCE);
While Not (&FIND)
Local number &NSTART = Find(".", &SOURCE, &START + 1);
If &NSTART = 0 Then
&FIND = True;
Else
&START = &NSTART;
End-If;
End-While;

Local number &FLEN = &LEN - &START;
Local string &FIELD = Substring(&SOURCE, &START + 1, &FLEN);
End-If;

&sErrText = &sErrText | &sErrMsgText | " ";
End-For;

%This.updateErrorLogTable(&strC_APP_SEQ, &strEMPLID, &sErrText);

&oPSMessageCollection.DeleteAll();
end-method;


/*定义日志表更新方法*/
method updateErrorLogTable
/+ &strC_APP_SEQ as String, +/
/+ &strEMPLID as String, +/
/+ &_errMsgText as String +/
Local Record &reApplyLog = CreateRecord(Record.C_APPLY_LOG);
&reApplyLog.C_OA_APPL_NUM.Value = &strC_APP_SEQ;
&reApplyLog.C_APPLY_ID.Value = "medresult";

If Not &reApplyLog.SelectByKey() Then
&reApplyLog.C_OA_APPL_NUM.Value = &strC_APP_SEQ;
&reApplyLog.C_APPLY_ID.Value = "medresult";
&reApplyLog.EMPLID.Value = &strEMPLID;
&reApplyLog.C_APPLY_DESCR.Value = "用人需求数据写入";
&reApplyLog.C_INTERFACE_STATUS.Value = "F";
&reApplyLog.DESCRLONG.Value = &_errMsgText;
&reApplyLog.LASTUPDDTTM.Value = %Datetime;
&reApplyLog.Insert();
Else
&reApplyLog.EMPLID.Value = &strEMPLID;
&reApplyLog.C_APPLY_DESCR.Value = "用人需求数据写入";
&reApplyLog.C_INTERFACE_STATUS.Value = "F";
&reApplyLog.DESCRLONG.Value = &_errMsgText;
&reApplyLog.LASTUPDDTTM.Value = %Datetime;
&reApplyLog.Update();
End-If;
CommitWork();
end-method;

Postman测试

步骤:

  1. 新增一个请求,选择POST类型,将之前PS服务操作的REST地址复制填入;
  2. body——>raw——>json;
  3. 填入请求json内容,点击Send;
  4. 查看response_body内容;

webservice(SOAP)接口

设置系统监听

创建消息

请求消息

模式页面设置,其中消息名 DQ_SOAP_REQ 需要根据实际情况调整

1
2
3
4
5
6
7
8
9
<?xml version="1.0"?>
<xsd:schema elementFormDefault="unqualified" targetNamespace="http://xmlns.oracle.com/Enterprise/Tools/schemas/DQ_SOAP_REQ.V1" xmlns="http://xmlns.oracle.com/Enterprise/Tools/schemas/DQ_SOAP_REQ.V1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="DQ_SOAP_REQ" type="DQ_SOAP_REQ_type"/>
<xsd:complexType name="DQ_SOAP_REQ_type">
<xsd:sequence>
<xsd:element name="RequestInfo" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

响应消息

模式页面设置,其中消息名 DQ_SOAP_RESP 需要根据实际情况调整

1
2
3
4
5
6
7
8
9
10
	
<?xml version="1.0"?>
<xsd:schema elementFormDefault="unqualified" targetNamespace="http://xmlns.oracle.com/Enterprise/Tools/schemas/DQ_SOAP_RESP.V1" xmlns="http://xmlns.oracle.com/Enterprise/Tools/schemas/DQ_SOAP_RESP.V1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="DQ_SOAP_RESP" type="DQ_SOAP_RESP_type"/>
<xsd:complexType name="DQ_SOAP_RESP_type">
<xsd:sequence>
<xsd:element name="ResponseInfo" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

创建服务

创建服务操作

常规设置

处理程序设置

编写处理方法代码

GetDataTest——处理类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import PS_PT:Integration:IRequestHandler;

class GetDataTest implements PS_PT:Integration:IRequestHandler
/*声明构造方法*/
method GetDataTest();
/*申明入口方法*/
method OnRequest(&MSG As Message) Returns Message;
end-class;

/*定义构造方法*/
method GetDataTest
end-method;

/*定义入口方法*/
method OnRequest
/+ &MSG as Message +/
/+ Returns Message +/
/+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/

Local Message &request, &response;
Local XmlNode &node;
Local array of XmlNode &searchRequestInfos, &searchUSERIDs, &searchPASSWORDs;
Local XmlDoc &reqXml;

/* Request message*/
&request = &MSG;
&reqXml = &MSG.GetXmlDoc();
&searchRequestInfos = CreateArray(&node);
&searchRequestInfos = &reqXml.GetElementsByTagName("RequestInfo");

/* 生成 响应Xml文档 */
Local XmlDoc &theResponseXml = CreateXmlDoc("<?xml version='1.0'?><dq:DQ_SOAP_RESP xmlns:dq='http://xmlns.oracle.com/Enterprise/Tools/schemas/DQ_SOAP_RESP.V1'/> ");
Local XmlNode &bodyNode = &theResponseXml.DocumentElement.AddElement("ResponseInfo").AddText("成功了!" | &searchRequestInfos [1].NodeName | "=" | &searchRequestInfos [1].NodeValue);
/* 生成 响应消息*/
&response = CreateMessage(Operation.DQ_TEST_SOAP, %IntBroker_Response);
&response.SetXmlDoc(&theResponseXml);
Return &response;

end-method;

注册web服务

soapUI接口测试工具测试

将前面得到的WSDL URL填入,新增接口测试Demo

填写入参,点击发送,得到响应