[Home] [Help]
PACKAGE BODY: APPS.ECX_STANDARD
Source
1 package body ECX_STANDARD as
2 -- $Header: ECXWACTB.pls 120.1.12010000.2 2008/11/18 18:11:43 cpeixoto ship $
3
4 /** bug 3357213 */
5 /**
6 * Other errors
7 */
8 PROCESSOR_ERR CONSTANT NUMBER := -20100;
9 NULL_ERR CONSTANT NUMBER := -20103;
10 G_PKG_NAME CONSTANT VARCHAR2(15):= 'ECX_STANDARD';
11 /** bug 3357213 */
12
13 MAX_JAVA_MEMORY CONSTANT NUMBER := 1 * 1024 * 1024 *1024; -- bug 6889689
14
15
16 function setMaxJavaMemorySize(num number) return number -- bug 6889689
17 is language java name
18 'oracle.aurora.vm.OracleRuntime.setMaxMemorySize(long) returns long';
19
20
21 procedure addItemAttributes
22 (
23 itemtype in varchar2,
24 itemkey in varchar2
25 )
26 is
27 begin
28 begin
29 wf_engine.SetItemAttrNumber(itemtype,itemkey,'ECX_ERROR_TYPE',ecx_utils.error_type);
30 exception
31 when others then
32
33 -- If item attribute does not exist then create it;
34
35 if ( wf_core.error_name = 'WFENG_ITEM_ATTR' ) then
36 wf_engine.AddItemAttr(itemtype,itemkey,'ECX_ERROR_TYPE',null,ecx_utils.error_type,null);
37 else
38 raise;
39 end if;
40 end;
41
42 begin
43 wf_engine.SetItemAttrText(itemtype,itemkey,'ECX_LOG_FILE',ecx_utils.g_logfile);
44 exception
45 when others then
46
47 -- If item attribute does not exist then create it;
48
49 if ( wf_core.error_name = 'WFENG_ITEM_ATTR' ) then
50 wf_engine.AddItemAttr(itemtype,itemkey,'ECX_LOG_FILE',ecx_utils.g_logfile,null,null);
51 else
52 raise;
53 end if;
54 end;
55 exception
56 when others then
57 raise;
58 end addItemAttributes;
59
60 procedure prepareWS(itemtype in VARCHAR2,
61 itemkey in VARCHAR2,
62 actid in NUMBER,
63 p_event in out nocopy WF_EVENT_T)
64 is
65
66 i_ws_soapaction VARCHAR2(240) := NULL;
67 i_ws_svc_namespace VARCHAR2(240) := NULL;
68 i_ws_port_operation VARCHAR2(240) := NULL;
69 i_ws_hdr_impl_class VARCHAR2(240) := NULL;
70 i_ws_res_impl_class VARCHAR2(240) := NULL;
71 i_ws_consumer VARCHAR2(240) := NULL;
72 i_parameterList WF_PARAMETER_LIST_T := NULL;
73
74 begin
75
76 if (p_event is not null) then
77 i_parameterList := wf_event_t.getParameterList(p_event);
78
79 -- Retrieve or default Web Services related event parameters if exists
80 i_ws_soapaction := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'SOAPACTION', true);
81 if (i_ws_soapaction is null) then
82 i_ws_soapaction := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'SOAPACTION', true);
83 if (i_ws_soapaction is null) and (i_parameterList is not null) then
84 i_ws_soapaction := wf_event.getValueForParameter('SOAPACTION', i_parameterList);
85 end if;
86 end if;
87 if (i_ws_soapaction is null) then
88 i_ws_soapaction := ' '; -- defaulting
89 end if;
90
91 i_ws_svc_namespace := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'WS_SERVICE_NAMESPACE', true);
92 if (i_ws_svc_namespace is null) then
93 i_ws_svc_namespace := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'WS_SERVICE_NAMESPACE', true);
94 if (i_ws_svc_namespace is null) and (i_parameterList is not null) then
95 i_ws_svc_namespace := wf_event.getValueForParameter('WS_SERVICE_NAMESPACE', i_parameterList);
96 end if;
97 end if;
98 if (i_ws_svc_namespace is null) then
99 i_ws_svc_namespace := 'http://xmlns.oracle.com/apps/fnd/XMLGateway'; -- defaulting
100 end if;
101
102 i_ws_port_operation := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'WS_PORT_OPERATION', true);
103 if (i_ws_port_operation is null) then
104 i_ws_port_operation := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'WS_PORT_OPERATION', true);
105 if (i_ws_port_operation is null) and (i_parameterList is not null) then
106 i_ws_port_operation := wf_event.getValueForParameter('WS_PORT_OPERATION', i_parameterList);
107 end if;
108 end if;
109 if (i_ws_port_operation is null) then
110 i_ws_port_operation := 'ReceiveDocument'; -- defaulting
111 end if;
112
113 i_ws_hdr_impl_class := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'WS_HEADER_IMPL_CLASS', true);
114 if (i_ws_hdr_impl_class is null) then
115 i_ws_hdr_impl_class := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'WS_HEADER_IMPL_CLASS', true);
116 if (i_ws_hdr_impl_class is null) and (i_parameterList is not null) then
117 i_ws_hdr_impl_class := wf_event.getValueForParameter('WS_HEADER_IMPL_CLASS', i_parameterList);
118 end if;
119 end if;
120 if (i_ws_hdr_impl_class is null) then
121 i_ws_hdr_impl_class := 'oracle.apps.fnd.wf.ws.client.DefaultHeaderGenerator'; -- defaulting
122 end if;
123
124 i_ws_res_impl_class := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'WS_RESPONSE_IMPL_CLASS', true);
125 if (i_ws_res_impl_class is null) then
126 i_ws_res_impl_class := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'WS_RESPONSE_IMPL_CLASS', true);
127 if (i_ws_res_impl_class is null) and (i_parameterList is not null) then
128 i_ws_res_impl_class := wf_event.getValueForParameter('WS_RESPONSE_IMPL_CLASS', i_parameterList);
129 end if;
130 end if;
131 if (i_ws_res_impl_class is null) then
132 i_ws_res_impl_class := 'oracle.apps.fnd.wf.ws.client.WfWsResponse'; -- defaulting
133 end if;
134
135 i_ws_consumer := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'WS_CONSUMER', true);
136 if (i_ws_consumer is null) then
137 i_ws_consumer := Wf_Engine.GetItemAttrText(itemtype, itemkey, 'WS_CONSUMER', true);
138 if (i_ws_consumer is null) and (i_parameterList is not null) then
139 i_ws_consumer := wf_event.getValueForParameter('WS_CONSUMER', i_parameterList);
140 end if;
141 end if;
142 if (i_ws_consumer is null) then
143 i_ws_consumer := 'ecx'; -- defaulting
144 end if;
145
146 -- add these properties to p_event
147 p_event.addParameterToList('SOAPACTION', i_ws_soapaction);
148 p_event.addParameterToList('WS_SERVICE_NAMESPACE', i_ws_svc_namespace);
149 p_event.addParameterToList('WS_PORT_OPERATION', i_ws_port_operation);
150 p_event.addParameterToList('WS_HEADER_IMPL_CLASS', i_ws_hdr_impl_class);
151 p_event.addParameterToList('WS_RESPONSE_IMPL_CLASS', i_ws_res_impl_class);
152 p_event.addParameterToList('WS_CONSUMER', i_ws_consumer);
153
154 end if;
155
156 exception
157 when others then
158 raise;
159 end prepareWS;
160
161
162 procedure XMLtoXMLCover
163 (
164 i_map_code IN varchar2,
165 i_inpayload IN CLOB,
166 i_outpayload OUT NOCOPY CLOB,
167 i_debug_level IN pls_integer
168 )
169 is
170 retcode pls_integer;
171 errmsg varchar2(2000);
172 logfile varchar2(200);
173 g_instlmode varchar2(100);
174 begin
175 ecx_inbound_trig.ProcessXML
176 (
177 i_map_code,
178 i_inpayload,
179 i_debug_level,
180 retcode,
181 errmsg,
182 logfile,
183 i_outpayload
184 );
185
186 if retcode = 0
187 then
188 return;
189 elsif retcode = 1
190 then
191 g_instlmode := wf_core.translate('WF_INSTALL');
192 IF g_instlmode = 'EMBEDDED'
193 THEN
194 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
195 ecx_utils.i_errparams));
196 wf_core.token('ECX_LOGFILE',logfile);
197 wf_core.raise('ECX_PROCESS_XMLERROR_EMBD');
198 ELSE
199 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
200 ecx_utils.i_errparams));
201 wf_core.token('ECX_LOGFILE',logfile);
202 wf_core.raise('ECX_PROCESS_XMLERROR');
203 END IF;
204 else
205 g_instlmode := wf_core.translate('WF_INSTALL');
206 IF g_instlmode = 'EMBEDDED'
207 THEN
208 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
209 ecx_utils.i_errparams));
210 wf_core.token('ECX_LOGFILE',logfile);
211 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
212 ELSE
213 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
214 ecx_utils.i_errparams));
215 wf_core.token('ECX_LOGFILE',logfile);
216 wf_core.raise('ECX_PROGRAM_EXIT');
217 END IF;
218 end if;
219 exception
220 when others then
221 wf_core.context('ECX_STANDARD','XMLtoXMLCover',i_map_code,i_debug_level);
222 raise;
223 end XMLtoXMLCover;
224
225 procedure processXMLCover
226 (
227 i_map_code IN varchar2,
228 i_inpayload IN CLOB,
229 i_debug_level IN pls_integer
230 )
231 is
232 retcode pls_integer;
233 errmsg varchar2(2000);
234 logfile varchar2(200);
235 i_outpayload CLOB;
236 g_instlmode varchar2(100);
237 begin
238 ecx_inbound_trig.ProcessXML
239 (
240 i_map_code,
241 i_inpayload,
242 i_debug_level,
243 retcode,
244 errmsg,
245 logfile,
246 i_outpayload
247 );
248
249 if retcode = 0
250 then
251 return;
252 elsif retcode = 1
253 then
254 g_instlmode := wf_core.translate('WF_INSTALL');
255 IF g_instlmode = 'EMBEDDED'
256 THEN
257 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
258 ecx_utils.i_errparams));
259 wf_core.token('ECX_LOGFILE',logfile);
260 wf_core.raise('ECX_PROCESS_XMLERROR_EMBD');
261 ELSE
262 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
263 ecx_utils.i_errparams));
264 wf_core.token('ECX_LOGFILE',logfile);
265 wf_core.raise('ECX_PROCESS_XMLERROR');
266 END IF;
267 else
268 g_instlmode := wf_core.translate('WF_INSTALL');
269 IF g_instlmode = 'EMBEDDED'
270 THEN
271 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
272 ecx_utils.i_errparams));
273 wf_core.token('ECX_LOGFILE',logfile);
274 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
275 ELSE
276 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
277 ecx_utils.i_errparams));
278 wf_core.token('ECX_LOGFILE',logfile);
279 wf_core.raise('ECX_PROGRAM_EXIT');
280 END IF;
281 end if;
282 exception
283 when others then
284 wf_core.context('ECX_STANDARD','processXMLCover',i_map_code,i_debug_level);
285 raise;
286 end processXMLCover;
287
288 procedure getXMLCover
289 (
290 i_message_standard IN VARCHAR2 default null,
291 i_transaction_type IN VARCHAR2 default null,
292 i_transaction_subtype IN VARCHAR2 default null,
293 i_tp_type IN VARCHAR2 default null,
294 i_tp_id IN VARCHAR2 default null,
295 i_tp_site_id IN VARCHAR2 default null,
296 i_document_id IN VARCHAR2 default null,
297 i_map_code IN VARCHAR2,
298 i_debug_level IN pls_integer,
299 i_xmldoc IN OUT NOCOPY CLOB,
300 i_message_type IN VARCHAR2 default 'XML'
301 )
302 is
303 retcode pls_integer;
304 errmsg varchar2(2000);
305 logfile varchar2(200);
306 g_instlmode varchar2(100);
307 begin
308 ecx_outbound.getXML
309 (
310 i_message_standard => i_message_standard,
311 i_map_code => i_map_code,
312 i_transaction_type => i_transaction_type,
313 i_transaction_subtype => i_transaction_subtype,
314 i_tp_type => i_tp_type,
315 i_tp_id => i_tp_id,
316 i_tp_site_id => i_tp_site_id,
317 i_document_id => i_document_id,
318 i_debug_level => i_debug_level,
319 i_xmldoc => i_xmldoc,
320 i_ret_code => retcode,
321 i_errbuf => errmsg,
322 i_log_file => logfile,
323 i_message_type => i_message_type
324 );
325 if retcode = 0
326 then
327 return;
328 elsif retcode = 1
329 then
330 g_instlmode := wf_core.translate('WF_INSTALL');
331 IF g_instlmode = 'EMBEDDED'
332 THEN
333 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
334 ecx_utils.i_errparams));
335 wf_core.token('ECX_LOGFILE',logfile);
336 wf_core.raise('ECX_GET_XMLERROR_EMBD');
337 ELSE
338 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
339 ecx_utils.i_errparams));
340 wf_core.token('ECX_LOGFILE',logfile);
341 wf_core.raise('ECX_GET_XMLERROR');
342 END IF;
343 else
344 g_instlmode := wf_core.translate('WF_INSTALL');
345 IF g_instlmode = 'EMBEDDED'
346 THEN
347 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
348 ecx_utils.i_errparams));
349 wf_core.token('ECX_LOGFILE',logfile);
350 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
351 ELSE
352 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
353 ecx_utils.i_errparams));
354 wf_core.token('ECX_LOGFILE',logfile);
355 wf_core.raise('ECX_PROGRAM_EXIT');
356 END IF;
357 end if;
358 exception
359 when others then
360 wf_core.context('ECX_STANDARD','getXMLCover',i_message_standard,i_transaction_type,i_transaction_subtype);
361 raise;
362 end getXMLCover;
363
364 /** (Synchronous) Send Direct api to avoid racing condition **/
365 procedure sendDirectCover(
366 transaction_type IN VARCHAR2,
367 transaction_subtype IN VARCHAR2,
368 party_id IN VARCHAR2,
369 party_site_id IN VARCHAR2,
370 party_type IN VARCHAR2, --bug #2183619
371 document_id IN VARCHAR2,
372 debug_mode IN PLS_INTEGER,
373 i_msgid OUT NOCOPY RAW
374 )
375 is
376 retcode pls_integer;
377 errmsg varchar2(2000);
378 g_instlmode varchar2(100);
379 begin
380
381 ecx_document.sendDirect
382 (
383 transaction_type => transaction_type,
384 transaction_subtype => transaction_subtype,
385 party_id => party_id,
386 party_site_id => party_site_id,
387 party_type => party_type,--bug #2183619
388 document_id => document_id,
389 debug_mode => debug_mode,
390 i_msgid => i_msgid,
391 retcode => retcode,
392 errmsg => errmsg
393 );
394 if retcode = 0
395 then
396 return;
397 elsif retcode = 1
398 then
399 g_instlmode := wf_core.translate('WF_INSTALL');
400 IF g_instlmode = 'EMBEDDED'
401 THEN
402 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
403 ecx_utils.i_errparams));
404 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
405 wf_core.raise('ECX_SENDDIRECT_ERROR_EMBD');
406 ELSE
407 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
408 ecx_utils.i_errparams));
409 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
410 wf_core.raise('ECX_SENDDIRECT_ERROR');
411 END IF;
412 else
413 g_instlmode := wf_core.translate('WF_INSTALL');
414 IF g_instlmode = 'EMBEDDED'
415 THEN
416 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
417 ecx_utils.i_errparams));
418 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
419 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
420 ELSE
421 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
422 ecx_utils.i_errparams));
423 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
424 wf_core.raise('ECX_PROGRAM_EXIT');
425 END IF;
426 end if;
427 exception
428 when others then
429 wf_core.context('ECX_STANDARD','sendDirectCover',transaction_type,transaction_subtype);
430 raise;
431 end sendDirectCover;
432
433
434 -- setEventDetails (PUBLIC)
435 -- Standard XML Gateway Raise Event
436 -- IN:
437 -- eventname - Event to be processes
438 -- eventkey - Event key
439 -- parameter1..10 - Event Parameters
440 -- NOTE:
441 -- Called from the XML gateway engine as a post processing action
442 --
443 -- VS - Why only parameters 1.10? Why not the the full 100?
444 -- We will change when the pl/sql has the capability to bind the PL/SQL table as datatype.
445 procedure setEventDetails(
446 eventname in varchar2,
447 eventkey in varchar2,
448 parameter1 in varchar2,
449 parameter2 in varchar2,
450 parameter3 in varchar2,
451 parameter4 in varchar2,
452 parameter5 in varchar2,
453 parameter6 in varchar2,
454 parameter7 in varchar2,
455 parameter8 in varchar2,
456 parameter9 in varchar2,
457 parameter10 in varchar2,
458 retcode OUT NOCOPY pls_integer,
459 retmsg OUT NOCOPY varchar2)
460 is
461 x_from_agt wf_agent_t := wf_agent_t(null,null);
462 x_to_agt wf_agent_t := wf_agent_t(null,null);
463
464 begin
465 wf_event_t.initialize(ecx_utils.g_event);
466 /**
467 Set the Event Data with the passed in parameters,
468 so that the Business Event can be raised.
469 **/
470
471 ecx_utils.g_event.setEventName(ltrim(rtrim(eventName)));
472 ecx_utils.g_event.setEventKey(ltrim(rtrim(eventKey)));
473
474 /**
475 x_from_agt has to be set.
476 In this case, what is the from agent? Inbound engine?!
477 Setting it to null for now.
478 **/
479
480 ecx_utils.g_event.from_agent := x_from_agt ;
481 ecx_utils.g_event.to_agent := x_to_agt ;
482
483 ecx_utils.g_event.addParameterToList('PARAMETER1', parameter1);
484 ecx_utils.g_event.addParameterToList('PARAMETER2', parameter2);
485 ecx_utils.g_event.addParameterToList('PARAMETER3', parameter3);
486 ecx_utils.g_event.addParameterToList('PARAMETER4', parameter4);
487 ecx_utils.g_event.addParameterToList('PARAMETER5', parameter5);
488 ecx_utils.g_event.addParameterToList('PARAMETER6', parameter6);
489 ecx_utils.g_event.addParameterToList('PARAMETER7', parameter7);
490 ecx_utils.g_event.addParameterToList('PARAMETER8', parameter8);
491 ecx_utils.g_event.addParameterToList('PARAMETER9', parameter9);
492 ecx_utils.g_event.addParameterToList('PARAMETER10', parameter10);
493
494 retcode :=0;
495 retmsg := ecx_debug.getTranslatedMessage('ECX_BUSINESS_EVT_SET');
496
497 exception
498 when others then
499 retcode := 2;
500 retmsg := ecx_debug.getTranslatedMessage('ECX_BUSINESS_EVT_SET_ERROR');
501 wf_core.raise('ECX_EVENT_ERROR');
502 end setEventDetails;
503
504
505 -- Generate (PUBLIC)
506 -- Standard XML Gateway to generate event data
507 -- IN:
508 -- p_event_name - Event to be processes
509 -- p_event_key - Event key
510 -- p_parameter_list - parameter list
511 -- OUT
512 -- CLOB - Event data
513 -- NOTE:
514 -- Called from the XML gateway engine as a post processing action
515 --
516 -- KH Comment: Do we need a version of this ofr the A2A case. map_code,doc_id only
517
518 function generate
519 (
520 p_event_name in varchar2,
521 p_event_key in varchar2,
522 p_parameter_list in wf_parameter_list_t
523 ) return CLOB
524 is
525 p_ret_code pls_integer;
526 p_errbuf varchar2(2000);
527 p_xmldoc clob;
528 ecx_getxml exception;
529 transaction_type varchar2(240);
530 transaction_subtype varchar2(240);
531 party_id varchar2(240);
532 party_site_id varchar2(240);
533 document_id varchar2(240);
534 debug_level pls_integer:=0;
535 map_code varchar2(200);
536 begin
537
538
539 -- VS - map_code = event_name WHY...Lets's discuss
540 -- map_code ect. should come from paramter list
541
542 dbms_lob.createtemporary(p_xmldoc,true,dbms_lob.session);
543 map_code := wf_event.getValueForParameter('ECX_MAP_CODE',p_parameter_list);
544 debug_level := wf_event.getValueForParameter('ECX_DEBUG_LEVEL',p_parameter_list);
545 /** Which exception to use here for throwing the Error to BES **/
546 if (map_code is null ) then
547 wf_core.token('MAP_CODE','NULL');
548 wf_core.raise('WFSQL_ARGS');
549 end if;
550
551 /** Everything else is optional set of parameters **/
552 transaction_type := wf_event.getValueForParameter('ECX_TRANSACTION_TYPE',p_parameter_list);
553 transaction_subtype := wf_event.getValueForParameter('ECX_TRANSACTION_SUBTYPE',p_parameter_list);
554 party_id := wf_event.getValueForParameter('ECX_PARTY_ID',p_parameter_list);
555 party_site_id := wf_event.getValueForParameter('ECX_PARTY_SITE_ID',p_parameter_list);
556 document_id := wf_event.getValueForParameter('ECX_DOCUMENT_ID',p_parameter_list);
557
558 if ecx_utils.g_event is null
559 then
560 wf_event_t.initialize(ecx_utils.g_event);
561 end if;
562
563 ecx_utils.g_event.setparameterlist(p_parameter_list);
564
565
566 getXMLCover
567 (
568 i_map_code => map_code,
569 i_transaction_type => transaction_type,
570 i_transaction_subtype => transaction_subtype,
571 i_tp_id => party_id,
572 i_tp_site_id => party_site_id,
573 i_document_id => document_id,
574 i_debug_level => debug_level,
575 i_xmldoc => p_xmldoc
576 );
577
578 -- Removed for time being as the parameters are IN type only.
579 --wf_event.addParameterToList('ECX_ERROR_TYPE', ecx_utils.error_type,p_parameter_list);
580 --wf_event.addParameterToList('ECX_LOG_FILE', ecx_utils.g_logfile,p_parameter_list);
581 --dbms_lob.freetemporary(p_xmldoc);
582 return p_xmldoc;
583 exception
584 when others then
585 wf_core.context('ECX_STANDARD', 'Generate', p_event_name, p_event_key);
586 raise;
587 end Generate;
588
589 -- XMLtoXML
590 -- Standard Workflow Activity XMLtoXML
591 -- Processes a given XML. The Output is an XML /a API call.
592 -- OUT
593 -- result - null
594 -- ACTIVITY ATTRIBUTES REFERENCED
595 -- MAP_CODE - text value (required)
596 -- ECX_EVENT_MESSAGE_IN - event value (required )
597 -- ECX_EVENT_MESSAGE_OUT - event value (optional )
598 -- NOTE:
599
600 procedure XMLtoXML (itemtype in varchar2,
601 itemkey in varchar2,
602 actid in number,
603 funcmode in varchar2,
604 resultout in out NOCOPY varchar2 )
605 is
606 i_debug_level pls_integer;
607 i_map_code varchar2(200);
608 i_outpayload clob;
609 i_log_file varchar2(2000);
610 i_ret_code pls_integer;
611 i_errbuf varchar2(2000);
612 i_inevent wf_event_t;
613 i_outevent wf_event_t;
614 ecx_process_xml exception;
615 i_error_type pls_integer;
616 aname_error_type varchar2(30);
617 aname_log_file varchar2(30);
618 aname varchar2(30);
619 atype varchar2(8);
620 aformat varchar2(240);
621 asubtype varchar2(8);
622 a1name varchar2(30);
623 a1type varchar2(8);
624 a1format varchar2(240);
625 a1subtype varchar2(8);
626
627 begin
628 -- Set the Global itemtype,itemkey and the activity_id
629 ecx_utils.g_item_type := itemtype;
630 ecx_utils.g_item_key := itemkey;
631 ecx_utils.g_activity_id := actid;
632
633 -- Do nothing in cancel or timeout mode
634 if (funcmode <> wf_engine.eng_run) then
635 resultout := wf_engine.eng_null;
636 return;
637 end if;
638
639 -- Get ecx map code
640
641 i_map_code := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MAP_CODE');
642 if (i_map_code is null ) then
643 wf_core.token('ECX_MAP_CODE','NULL');
644 wf_core.raise('WFSQL_ARGS');
645 end if;
646
647
648
649 i_debug_level := nvl(wf_engine.GetItemAttrText(itemtype,itemkey,'ECX_DEBUG_LEVEL',true),0);
650
651
652 -- Verify that the attr type = EVENT
653
654 i_inevent := Wf_Engine.GetActivityAttrEvent(itemtype, itemkey, actid, 'ECX_EVENT_MESSAGE_IN');
655 if (i_inevent is null ) then
656 wf_core.token('ECX_EVENT_MESSAGE_IN','NULL');
657 wf_core.raise('WFSQL_ARGS');
658 end if;
659
660 aname := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_EVENT_MESSAGE_OUT');
661 if ( aname is null ) then
662 wf_core.token('ECX_EVENT_MESSAGE_OUT','NULL');
663 wf_core.raise('WFSQL_ARGS');
664 end if;
665
666 --Wf_Engine.GetItemAttrInfo(itemtype, aname ,atype, asubtype, aformat);
667 --if (atype <> 'EVENT' ) then
668 --wf_core.token('VTYPE',atype);
669 --wf_core.raise('WFXXXV_VTYPE');
670 --end if;
671
672 i_outevent := Wf_Engine.GetItemAttrEvent(itemtype, itemkey, aname);
673
674 -- extract payload and pass to ECX
675
676 XMLtoXMLCover
677 (
678 i_map_code,
679 i_inevent.event_data,
680 i_outevent.event_data,
681 i_debug_level
682 );
683
684 addItemAttributes(itemtype,itemkey);
685 wf_engine.SetItemAttrEvent(itemtype,itemkey,aname,i_outevent);
686
687 resultout := 'COMPLETE:';
688 exception
689 when others then
690 Wf_Core.Context('ECX_STANDARD', 'XMLtoXML',itemtype,itemkey, to_char(actid), funcmode);
691 raise;
692 end XMLtoXML;
693
694 procedure ProcessXML(itemtype in varchar2,
695 itemkey in varchar2,
696 actid in number,
697 funcmode in varchar2,
698 resultout in out NOCOPY varchar2 )
699 is
700 i_debug_level pls_integer;
701 i_map_code varchar2(200);
702 i_payload clob;
703 i_outpayload clob;
704 i_log_file varchar2(2000);
705 i_ret_code pls_integer;
706 i_errbuf varchar2(2000);
707 i_event wf_event_t;
708 ecx_process_xml exception;
709 i_error_type pls_integer;
710 aname_error_type varchar2(30);
711 aname_log_file varchar2(30);
712
713 begin
714 -- Set the Global itemtype,itemkey and the activity_id
715 ecx_utils.g_item_type := itemtype;
716 ecx_utils.g_item_key := itemkey;
717 ecx_utils.g_activity_id := actid;
718
719 -- Do nothing in cancel or timeout mode
720 if (funcmode <> wf_engine.eng_run) then
721 resultout := wf_engine.eng_null;
722 return;
723 end if;
724
725 -- Get ecx map code
726
727 i_map_code := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MAP_CODE');
728 if (i_map_code is null ) then
729 wf_core.token('ECX_MAP_CODE','NULL');
730 wf_core.raise('WFSQL_ARGS');
731 end if;
732
733
734
735 i_debug_level := nvl(wf_engine.GetItemAttrText(itemtype,itemkey,'ECX_DEBUG_LEVEL',true),0);
736 i_event := Wf_Engine.GetActivityAttrEvent(itemtype, itemkey, actid, 'ECX_EVENT_MESSAGE');
737 if (i_event is null ) then
738 wf_core.token('ECX_EVENT_MESSAGE','NULL');
739 wf_core.raise('WFSQL_ARGS');
740 end if;
741
742 -- extract payload and pass to ECX
743
744 i_payload := i_event.event_data;
745
746 processXMLCover
747 (
748 i_map_code,
749 i_payload,
750 i_debug_level
751 );
752
753 addItemAttributes(itemtype,itemkey);
754
755
756 resultout := 'COMPLETE:';
757 exception
758 when others then
759 Wf_Core.Context('ECX_STANDARD', 'PROCESSXML',itemtype,itemkey, to_char(actid), funcmode);
760 raise;
761 end processXML;
762
763 -- IsDeliveryRequired
764 -- Standard ECX Workflow Activity
765 -- Determine if trading partner is enabled to recieve document
766 -- OUT
767 -- result - T - Trading Partner is enabled
768 -- F - Trading Partner is NOT enabled
769 -- ACTIVITY ATTRIBUTES REFERENCED
770 -- TRANSACTION_TYPE - text value (required)
771 -- TRANSACTION_SUBTYPE - text value (required)
772 -- PARTY_ID - text value (required)
773 -- PARTY_SITE_ID - text value (optional)
774 -- NOTE:
775
776 procedure isDeliveryRequired (itemtype in varchar2,
777 itemkey in varchar2,
778 actid in number,
779 funcmode in varchar2,
780 resultout in out NOCOPY varchar2)
781 is
782 transaction_type varchar2(240);
783 transaction_subtype varchar2(240);
784 party_id varchar2(240);
785 party_site_id varchar2(240);
786 party_type VARCHAR2(300); --Bug #2183619
787 aname varchar2(30); --Bug #2215677
788 retcode pls_integer;
789 errmsg varchar2(2000);
790 result boolean := FALSE;
791 i_confirmation number; --Bug #2215677
792 g_instlmode varchar2(100);
793 begin
794
795 -- Set the Global itemtype,itemkey and the activity_id
796 ecx_utils.g_item_type := itemtype;
797 ecx_utils.g_item_key := itemkey;
798 ecx_utils.g_activity_id := actid;
799
800 -- Do nothing in cancel or timeout mode
801
802 if (funcmode <> wf_engine.eng_run) then
803 resultout := wf_engine.eng_null;
804 return;
805 end if;
806
807 -- Retreive Activity Attributes
808
809 transaction_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_TYPE');
810 if ( transaction_type is null ) then
811 wf_core.token('ECX_TRANSACTION_TYPE','NULL');
812 wf_core.raise('WFSQL_ARGS');
813 end if;
814
815 transaction_subtype := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_SUBTYPE');
816 if ( transaction_subtype is null ) then
817 wf_core.token('ECX_TRANSACTION_SUBTYPE','NULL');
818 wf_core.raise('WFSQL_ARGS');
819 end if;
820
821 party_site_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_SITE_ID');
822 if ( party_site_id is null ) then
823 wf_core.token('ECX_PARTY_SITE_ID','NULL');
824 wf_core.raise('WFSQL_ARGS');
825 end if;
826
827 -- party_id is optional. Only party_site_id is required
828
829 party_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_ID');
830 /* Start of bug #2183619 */
831 party_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARTY_TYPE', true);
832 /* End of bug #2183619*/
833
834 /* Start of changes for Bug #2215677*/
835 -- Get confirmation status of the trading partner.
836 aname := wf_engine.GetActivityAttrText(itemtype, itemkey, actid,
837 'ECX_CONFIRMATION_FLAG', ignore_notfound => true);
838 if (aname is not null) then
839 ecx_document.getConfirmationStatus(
840 i_transaction_type => transaction_type,
841 i_transaction_subtype => transaction_subtype,
842 i_party_id => party_id,
843 i_party_site_id => party_site_id,
844 i_party_type => party_type,
845 o_confirmation => i_confirmation
846 );
847 wf_engine.SetItemAttrText ( itemtype => itemtype,
848 itemkey => itemkey,
849 aname => aname,
850 avalue => i_confirmation);
851 end if;
852 /* End of changes for Bug #2215677*/
853
854
855 ecx_document.isDeliveryRequired
856 (
857 transaction_type => transaction_type,
858 transaction_subtype => transaction_subtype,
859 party_id => party_id,
860 party_site_id => party_site_id,
861 party_type => party_type, --bug #2183619
862 resultout => result,
863 retcode => retcode,
864 errmsg => errmsg
865 );
866 if (result)
867 then
868 -- Reached Here. Successful execution.
869 resultout := 'COMPLETE:T';
870 else
871 resultout := 'COMPLETE:F';
872 end if;
873 exception
874 when ecx_document.ecx_transaction_not_defined then
875 wf_core.context('ECX_STANDARD','isDeliveryRequiredCover',transaction_type,transaction_subtype, party_id,party_site_id);
876 wf_core.token('ECX_TRANSACTION_TYPE', transaction_type);
877 wf_core.token('ECX_TRANSACTION_SUBTYPE', transaction_subtype);
878 wf_core.raise('ECX_TRANSACTION_NOT_DEFINED');
879 when ecx_document.ecx_delivery_setup_error then
880 wf_core.context('ECX_STANDARD','isDeliveryRequiredCover',transaction_type,transaction_subtype, party_id,party_site_id);
881 wf_core.token('ECX_PARTY_ID', party_id);
882 wf_core.token('ECX_PARTY_SITE_ID', party_site_id);
883 wf_core.token('ECX_TRANSACTION_TYPE', transaction_type);
884 wf_core.token('ECX_TRANSACTION_SUBTYPE', transaction_subtype);
885 wf_core.raise('ECX_DELIVERY_SETUP_ERROR');
886
887 when ecx_utils.program_exit then
888 wf_core.context('ECX_STANDARD','isDeliveryRequiredCover',transaction_type,transaction_subtype, party_id,party_site_id);
889 g_instlmode := wf_core.translate('WF_INSTALL');
890 IF g_instlmode = 'EMBEDDED'
891 THEN
892 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(ecx_utils.i_errbuf,
893 ecx_utils.i_errparams));
894 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
895 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
896 ELSE
897 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
898 ecx_utils.i_errparams));
899 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
900 wf_core.raise('ECX_PROGRAM_EXIT');
901 END IF;
902
903 when others then
904 raise;
905 end isDeliveryRequired;
906
907
908 -- Send
909 -- Standard ECX Workflow Activity
910 -- Send Event to AQ for delivery
911 -- OUT
912 -- result - null
913 --
914 -- ACTIVITY ATTRIBUTES REFERENCED
915 -- TRANSACTION_TYPE - text value (required)
916 -- TRANSACTION_SUBTYPE - text value (required)
917 -- PARTY_ID - text value (optional)
918 -- PARTY_SITE_ID - text value (required)
919 -- DOCUMENT_D - text value (required)
920 -- PARAMETER1..5 - text value (optional)
921 -- SEND_MODE - Text (lookup: SYNCH ASYNCH ) (required)
922 -- NOTE:
923
924 procedure send(itemtype in varchar2,
925 itemkey in varchar2,
926 actid in number,
927 funcmode in varchar2,
928 resultout in out NOCOPY varchar2)
929 is
930 transaction_type varchar2(240);
931 transaction_subtype varchar2(240);
932 party_id varchar2(240);
933 party_site_id varchar2(240);
934 party_type varchar2(200); -- bug #2183619
935 document_id varchar2(240);
936 parameter1 varchar2(240);
937 parameter2 varchar2(240);
938 parameter3 varchar2(240);
939 parameter4 varchar2(240);
940 parameter5 varchar2(240);
941
942 debug_mode pls_integer:=0;
943 send_mode varchar2(20);
944 msgid raw(16);
945 trigger_id binary_integer;
946 retcode binary_integer:=0;
947 errmsg varchar2(2000);
948 aname varchar2(30);
949 atype varchar2(8);
950 aformat varchar2(240);
951 asubtype varchar2(8);
952 result varchar2(30);
953 status varchar2(8);
954 begin
955 -- Set the Global itemtype,itemkey and the activity_id
956 ecx_utils.g_item_type := itemtype;
957 ecx_utils.g_item_key := itemkey;
958 ecx_utils.g_activity_id := actid;
959
960 -- Do nothing in cancel or timeout mode
961 if (funcmode <> wf_engine.eng_run) then
962 resultout := wf_engine.eng_null;
963 return;
964 end if;
965
966 -- We need to determine which parameters are required and which are optional
967
968 transaction_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_TYPE');
969 if ( transaction_type is null ) then
970 wf_core.token('ECX_TRANSACTION_TYPE','NULL');
971 wf_core.raise('WFSQL_ARGS');
972 end if;
973
974 transaction_subtype := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_SUBTYPE');
975 if ( transaction_subtype is null ) then
976 wf_core.token('ECX_TRANSACTION_SUBTYPE','NULL');
977 wf_core.raise('WFSQL_ARGS');
978 end if;
979
980 party_site_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_SITE_ID');
981 if ( transaction_type <> 'ECX' and transaction_subtype <> 'CBODO' )
982 then
983 if ( party_site_id is null )
984 then
985 wf_core.token('ECX_PARTY_SITE_ID','NULL');
986 wf_core.raise('WFSQL_ARGS');
987 end if;
988 end if;
989
990 -- party_id is optional. Only party_site_id is required
991
992 party_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_ID');
993 /* Start of bug #2183619 */
994 party_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARTY_TYPE', ignore_notfound => true);
995
996 /* End of bug #2183619 */
997
998 -- It is an optional Field
999 document_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_DOCUMENT_ID');
1000 /**
1001 if ( document_id is null ) then
1002 wf_core.token('ECX_DOCUMENT_ID','NULL');
1003 wf_core.raise('WFSQL_ARGS');
1004 end if;
1005 **/
1006
1007 debug_mode := nvl(Wf_Engine.GetItemAttrText(itemtype, itemkey, 'ECX_DEBUG_LEVEL',true),0);
1008
1009 /** Check for the Item Attribute of type ECX_EVENT_MESSAGE. If found , then use that to initialize the
1010 global variable for ecx_utils.g_event or create a local instance.
1011 **/
1012 begin
1013 -- Initialize the Event before using it.
1014 wf_event_t.initialize(ecx_utils.g_event);
1015 ecx_utils.g_event := Wf_Engine.GetItemAttrEvent(itemtype, itemkey,'ECX_EVENT_MESSAGE');
1016 exception
1017 when others then
1018 if ecx_utils.g_event is null
1019 then
1020 wf_event_t.initialize(ecx_utils.g_event);
1021 end if;
1022 end;
1023
1024
1025 /* Start of changes for bug 2120165 */
1026 parameter1 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER1');
1027 parameter2 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER2');
1028 parameter3 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER3');
1029 parameter4 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER4');
1030 parameter5 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER5');
1031 /* End of changes for bug 2120165*/
1032
1033 -- Add the above Parameters to the Global Event Message Object
1034 -- For backward compatability , we are passing ECX_PARAMETER1 -> PARAMETER1 on the Engine.
1035 ecx_utils.g_event.addparametertolist('PARAMETER1',parameter1);
1036 ecx_utils.g_event.addparametertolist('PARAMETER2',parameter2);
1037 ecx_utils.g_event.addparametertolist('PARAMETER3',parameter3);
1038 ecx_utils.g_event.addparametertolist('PARAMETER4',parameter4);
1039 ecx_utils.g_event.addparametertolist('PARAMETER5',parameter5);
1040
1041
1042 send_mode := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_SEND_MODE');
1043
1044 wf_Item_Activity_Status.Result(itemtype, itemkey, actid, status, result);
1045
1046 -- KH comment: There is a more efficient way of doing this. The execution test
1047 -- Should come before any attributes are retrived
1048
1049 if (result = wf_engine.eng_null)
1050 then
1051 -- Second execution.
1052 -- Wait is completed, return complete result.
1053 -- Call the XML gateway Outbound Engine
1054 -- party type is added as one more parameter with bug #2183619
1055 sendDirectCover
1056 (
1057 transaction_type => transaction_type,
1058 transaction_subtype => transaction_subtype,
1059 party_id => party_id,
1060 party_site_id => party_site_id,
1061 party_type => party_type,
1062 document_id => document_id,
1063 debug_mode => debug_mode,
1064 i_msgid => msgid
1065 );
1066
1067 aname := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MSGID_ATTR');
1068 wf_engine.SetItemAttrText(itemtype,itemkey,aname,msgid);
1069
1070 addItemAttributes(itemtype,itemkey);
1071
1072 resultout := wf_engine.eng_completed||':'||wf_engine.eng_null;
1073 else
1074 -- First execution.
1075 -- Check for A-synch or Synch Mode
1076 if ( send_mode = 'ASYNCH')
1077 then
1078 -- If Async , deffer the executio
1079 resultout := wf_engine.eng_deferred;
1080 elsif ( ( send_mode is null ) or ( send_mode = 'SYNCH' ) )
1081 then
1082 -- Call the XML gateway Outbound Engine
1083 -- added party_type with bug #2183619
1084 sendDirectCover
1085 (
1086 transaction_type => transaction_type,
1087 transaction_subtype => transaction_subtype,
1088 party_id => party_id,
1089 party_site_id => party_site_id,
1090 party_type => party_type,
1091 document_id => document_id,
1092 debug_mode => debug_mode,
1093 i_msgid => msgid
1094 );
1095
1096 aname := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MSGID_ATTR');
1097 wf_engine.SetItemAttrText(itemtype,itemkey,aname,msgid);
1098
1099 addItemAttributes(itemtype,itemkey);
1100
1101 resultout := wf_engine.eng_completed||':'||wf_engine.eng_null;
1102 end if;
1103 end if;
1104
1105 exception
1106 when others then
1107 Wf_Core.Context('ECX_STANDARD', 'Send', itemtype, itemkey, to_char(actid), funcmode);
1108 raise;
1109 end send;
1110
1111 -- GetXMLTP
1112 -- Standard ECX Workflow Activity
1113 -- Retrieve XML document
1114 -- OUT
1115 -- result - null
1116 --
1117 -- ACTIVITY ATTRIBUTES REFERENCED
1118 -- TRANSACTION_TYPE - text value (Required)
1119 -- TRANSACTION_SUBTYPE - text value (Required)
1120 -- PARTY_SITE_ID - text value (Required)
1121 -- PARTY_ID - text value (optional)
1122 -- DOCUMENT_D - text value (Required)
1123 -- EVENT_NAME - text value (optional)
1124 -- EVENT_KEY - text value (optional)
1125 -- PARAMETER1..5 - text value (optional)
1126 --
1127 -- EVENT_MESSAGE - Item ATTR (required)
1128 -- NOTE:
1129
1130 procedure GetXMLTP(itemtype in varchar2,
1131 itemkey in varchar2,
1132 actid in number,
1133 funcmode in varchar2,
1134 resultout in out NOCOPY varchar2)
1135 is
1136 i_debug_level pls_integer :=0;
1137 retcode pls_integer;
1138 errmsg varchar2(2000);
1139 transaction_type VARCHAR2(240);
1140 transaction_subtype VARCHAR2(240);
1141 party_id varchar2(240);
1142 party_site_id varchar2(240);
1143 document_id varchar2(240);
1144
1145 parameter1 varchar2(240);
1146 parameter2 varchar2(240);
1147 parameter3 varchar2(240);
1148 parameter4 varchar2(240);
1149 parameter5 varchar2(240);
1150 event_name varchar2(240);
1151 event_key varchar2(240);
1152 i_event wf_event_t;
1153 aname varchar2(30);
1154 evt_name varchar2(30);
1155 atype varchar2(8);
1156 aformat varchar2(240);
1157 asubtype varchar2(8);
1158 i_error_type pls_integer;
1159
1160 p_party_type varchar2(240);
1161 p_message_type varchar2(240);
1162 p_message_standard varchar2(240);
1163 p_ext_type varchar2(240);
1164 p_ext_subtype varchar2(240);
1165 p_source_code varchar2(240);
1166 p_destination_code varchar2(240);
1167 p_destination_type varchar2(240);
1168 p_destination_address varchar2(2000);
1169 p_username ecx_tp_details.username%TYPE;
1170 p_password ecx_tp_details.password%TYPE;
1171 p_map_code varchar2(240);
1172 p_queue_name varchar2(240);
1173 p_tp_header_id pls_integer;
1174
1175 p_party_id varchar2(240);
1176 p_party_site_id varchar2(240);
1177 i_agt_guid wf_agents.guid%TYPE;
1178 trigger_id number := 0;
1179 i_param_list wf_parameter_list_t;
1180 i_from_agent wf_agent_t;
1181 i_from_agent_name varchar2(240);
1182 i_from_system_name varchar2(240);
1183 g_instlmode varchar2(100);
1184
1185 cursor c1
1186 is
1187 select ecx_trigger_id_s.NEXTVAL
1188 from dual;
1189
1190 begin
1191 -- Set the Global itemtype,itemkey and the activity_id
1192 ecx_utils.g_item_type := itemtype;
1193 ecx_utils.g_item_key := itemkey;
1194 ecx_utils.g_activity_id := actid;
1195
1196 -- Do nothing in cancel or timeout mode
1197 if (funcmode <> wf_engine.eng_run) then
1198 resultout := wf_engine.eng_null;
1199 return;
1200 end if;
1201
1202
1203 i_debug_level := nvl(Wf_Engine.GetItemAttrText(itemtype, itemkey, 'ECX_DEBUG_LEVEL',true),0);
1204
1205
1206 -- Retreive Activity Attributes
1207
1208 transaction_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_TYPE');
1209 if ( transaction_type is null ) then
1210 wf_core.token('ECX_TRANSACTION_TYPE','NULL');
1211 wf_core.raise('WFSQL_ARGS');
1212 end if;
1213
1214 transaction_subtype := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_TRANSACTION_SUBTYPE');
1215 if ( transaction_subtype is null ) then
1216 wf_core.token('ECX_TRANSACTION_SUBTYPE','NULL');
1217 wf_core.raise('WFSQL_ARGS');
1218 end if;
1219
1220 party_site_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_SITE_ID');
1221
1222 if ( transaction_type <> 'ECX' and transaction_subtype <> 'CBODO' )
1223 then
1224 if ( party_site_id is null ) then
1225 wf_core.token('ECX_PARTY_SITE_ID','NULL');
1226 wf_core.raise('WFSQL_ARGS');
1227 end if;
1228 end if;
1229
1230 -- party_id is optional. Only party_site_id is required
1231
1232 party_id := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_PARTY_ID');
1233
1234 /* Start of bug #2183619 */
1235
1236 p_party_type := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARTY_TYPE', true);
1237
1238 /* End of bug #2183619*/
1239
1240 document_id := Wf_Engine.GetActivityAttrTEXT(itemtype, itemkey, actid, 'ECX_DOCUMENT_ID');
1241
1242
1243 -- Verify that the attr type = EVENT
1244
1245 evt_name := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_EVENT_MESSAGE');
1246 if ( evt_name is null ) then
1247 wf_core.token('ECX_EVENT_MESSAGE','NULL');
1248 wf_core.raise('WFSQL_ARGS');
1249 end if;
1250
1251 Wf_Engine.GetItemAttrInfo(itemtype, evt_name ,atype, asubtype, aformat);
1252 if (atype <> 'EVENT' ) then
1253 wf_core.token('VTYPE',atype);
1254 wf_core.raise('WFXXXV_VTYPE');
1255 end if;
1256
1257 i_event := Wf_Engine.GetItemAttrEvent(itemtype, itemkey, evt_name);
1258 /**
1259 Populate the Parameters in the original event Object being passed. if it is null , initialize and create
1260 a new Instance and populate the variables
1261 if i_event is null
1262 then
1263 wf_event_t.initialize(ecx_utils.g_event);
1264 else
1265 ecx_utils.g_event := i_event;
1266 end if;
1267 **/
1268
1269 /* Always initialize ecx_utils.g_event before using it */
1270 wf_event_t.initialize(ecx_utils.g_event);
1271 if i_event is not null
1272 then
1273 ecx_utils.g_event := i_event;
1274 End If;
1275
1276 parameter1 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER1');
1277 parameter2 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER2');
1278 parameter3 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER3');
1279 parameter4 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER4');
1280 parameter5 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER5');
1281 -- Add the above Parameters to the Global Event Message Object
1282 -- For backward compatability , we are passing ECX_PARAMETER1 -> PARAMETER1 on the Engine.
1283 ecx_utils.g_event.addparametertolist('PARAMETER1',parameter1);
1284 ecx_utils.g_event.addparametertolist('PARAMETER2',parameter2);
1285 ecx_utils.g_event.addparametertolist('PARAMETER3',parameter3);
1286 ecx_utils.g_event.addparametertolist('PARAMETER4',parameter4);
1287 ecx_utils.g_event.addparametertolist('PARAMETER5',parameter5);
1288
1289 open c1;
1290 fetch c1 into trigger_id;
1291 close c1;
1292
1293 -- invoke trigger_outbound which will invoke outbound_trigger, getConfirmation and
1294 -- get_delivery_attribs
1295 ecx_debug.setErrorInfo(10,10,'ECX_TRIGGER_OUTBOUND');
1296 ecx_document.trigger_outbound(transaction_type, transaction_subtype,
1297 party_id, party_site_id,
1298 document_id, ecx_utils.i_ret_code,
1299 ecx_utils.i_errbuf, trigger_id,
1300 p_party_type, p_party_id, p_party_site_id,
1301 p_message_type, p_message_standard,
1302 p_ext_type, p_ext_subtype, p_source_code,
1303 p_destination_code, p_destination_type,
1304 p_destination_address, p_username, p_password,
1305 p_map_code, p_queue_name, p_tp_header_id
1306 );
1307 -- do outbound logging
1308 ecx_debug.setErrorInfo(10,10, 'ECX_PROCESSING_MESSAGE');
1309 ecx_errorlog.outbound_engine (trigger_id,
1310 ecx_utils.i_ret_code,
1311 ecx_utils.i_errbuf,
1312 null,null,p_party_type
1313 );
1314
1315 -- prepare WS related event if it is SOAP protocol type
1316 if (upper(p_destination_type) = 'SOAP') then
1317 prepareWS(itemtype, itemkey, actid, ecx_utils.g_event);
1318 end if;
1319
1320 -- if the from agent is not yet set by users, reset it based on the retrieve
1321 -- protocol_type. Otherwise, honor whatever has been set by the users.
1322 if (not ecx_utils.g_event.GetFromAgent() is null)
1323 then
1324 i_from_agent_name := ecx_utils.g_event.GetFromAgent().GetName();
1325 i_from_system_name := ecx_utils.g_event.GetFromAgent().GetSystem();
1326 end if;
1327
1328 if (i_from_agent_name is null AND i_from_system_name is null)
1329 or (i_from_agent_name = 'WF_DEFERRED')
1330 then
1331 if (upper(p_destination_type) = 'SOAP') then
1332 i_from_agent_name := 'WF_WS_JMS_OUT';
1333 else
1334 if (upper(p_destination_type) = 'JMS') then
1335 if(p_destination_address is null) then
1336 i_from_agent_name := 'WF_JMS_OUT';
1337 else
1338 i_from_agent_name := p_destination_address;
1339 end if;
1340 else
1341 i_from_agent_name := 'ECX_OUTBOUND';
1342 end if;
1343 end if;
1344
1345 begin
1346 select name
1347 into i_from_system_name
1348 from wf_systems
1349 where guid = wf_core.translate('WF_SYSTEM_GUID');
1350 exception
1351 when others then
1352 raise;
1353 end;
1354
1355 i_from_agent := wf_agent_t(i_from_agent_name, i_from_system_name);
1356 ecx_utils.g_event.setFromAgent(i_from_agent);
1357
1358 end if;
1359
1360 getXMLcover
1361 (
1362 i_message_standard => p_message_standard,
1363 i_map_code => p_map_code,
1364 i_transaction_type => transaction_type,
1365 i_transaction_subtype => transaction_subtype,
1366 i_tp_type => p_party_type,
1367 i_tp_id => p_party_id,
1368 i_tp_site_id => p_party_site_id,
1369 i_document_id => document_id,
1370 i_debug_level => i_debug_level,
1371 i_xmldoc => ecx_utils.g_event.event_data,
1372 i_message_type => p_message_type);
1373
1374 ecx_debug.setErrorInfo(0,10,'ECX_MESSAGE_CREATED');
1375 ecx_errorlog.outbound_engine (trigger_id,
1376 ecx_utils.i_ret_code,
1377 ecx_utils.i_errbuf,
1378 null,null,p_party_type
1379 );
1380
1381 -- Following part is needed only when getxmltp is used with wf_event.send
1382 -- set ecx_utils.g_event with the envelope information. This will later be used
1383 -- by the queue handler to enqueue on ECX_OUTBOUND
1384 ecx_utils.g_event.addParameterToList('PARTY_TYPE', p_party_type);
1385 ecx_utils.g_event.addParameterToList('PARTYID', p_party_id);
1386 ecx_utils.g_event.addParameterToList('PARTY_SITE_ID', p_source_code);
1387 ecx_utils.g_event.addParameterToList('DOCUMENT_NUMBER', ecx_utils.g_document_id);
1388 ecx_utils.g_event.addParameterToList('MESSAGE_TYPE', p_message_type);
1389 ecx_utils.g_event.addParameterToList('MESSAGE_STANDARD', p_message_standard);
1390 ecx_utils.g_event.addParameterToList('TRANSACTION_TYPE', p_ext_type);
1391 ecx_utils.g_event.addParameterToList('TRANSACTION_SUBTYPE', p_ext_subtype);
1392 ecx_utils.g_event.addParameterToList('PROTOCOL_TYPE', p_destination_type);
1393 ecx_utils.g_event.addParameterToList('PROTOCOL_ADDRESS', p_destination_address);
1394 ecx_utils.g_event.addParameterToList('USERNAME', p_username);
1395 ecx_utils.g_event.addParameterToList('PASSWORD', p_password);
1396 ecx_utils.g_event.addParameterToList('ATTRIBUTE1', ecx_utils.g_company_name);
1397 ecx_utils.g_event.addParameterToList('ATTRIBUTE2', null);
1398 ecx_utils.g_event.addParameterToList('ATTRIBUTE3', p_destination_code);
1399 ecx_utils.g_event.addParameterToList('ATTRIBUTE4', null);
1400 ecx_utils.g_event.addParameterToList('ATTRIBUTE5', null);
1401 ecx_utils.g_event.addParameterToList('LOGFILE', ecx_utils.g_logfile);
1402 ecx_utils.g_event.addParameterToList('TRIGGER_ID', trigger_id);
1403 ecx_utils.g_event.addParameterToList('ITEM_TYPE', itemtype);
1404 ecx_utils.g_event.addParameterToList('ITEM_KEY', itemkey);
1405
1406 -- Populate event structure and set item attribute
1407
1408 if event_name is not null
1409 then
1410 i_event.SetEventName(event_name);
1411 end if;
1412
1413 if event_key is not null
1414 then
1415 i_event.SetEventKey(event_key);
1416 end if;
1417
1418 -- set the event data back
1419 wf_engine.SetItemAttrEvent(itemtype, itemkey, evt_name, ecx_utils.g_event);
1420
1421 addItemAttributes(itemtype,itemkey);
1422
1423 resultout := 'COMPLETE:';
1424
1425 exception
1426 when ecx_document.ecx_transaction_not_defined then
1427 ecx_errorlog.outbound_trigger
1428 (
1429 trigger_id, transaction_type, transaction_subtype,
1430 p_party_id, p_party_site_id, p_party_type,
1431 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1432 );
1433
1434 wf_core.context('ECX_STANDARD','getXMLTP',transaction_type,transaction_subtype,party_id,party_site_id);
1435 wf_core.token('ECX_TRANSACTION_TYPE', transaction_type);
1436 wf_core.token('ECX_TRANSACTION_SUBTYPE', transaction_subtype);
1437 wf_core.raise('ECX_TRANSACTION_NOT_DEFINED');
1438 when ecx_document.ecx_no_delivery_required then
1439 ecx_errorlog.outbound_trigger
1440 (
1441 trigger_id, transaction_type, transaction_subtype,
1442 p_party_id, p_party_site_id, p_party_type,
1443 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1444 );
1445
1446 wf_core.context('ECX_STANDARD','getXMLTP',transaction_type,transaction_subtype,party_id,party_site_id);
1447 g_instlmode := wf_core.translate('WF_INSTALL');
1448 IF g_instlmode = 'EMBEDDED'
1449 THEN
1450 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(ecx_utils.i_errbuf,
1451 ecx_utils.i_errparams));
1452 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1453 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
1454 ELSE
1455 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1456 ecx_utils.i_errparams));
1457 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1458 wf_core.raise('ECX_PROGRAM_EXIT');
1459 END IF;
1460 when ecx_document.ecx_no_party_setup then
1461 ecx_errorlog.outbound_trigger
1462 (
1463 trigger_id, transaction_type, transaction_subtype,
1464 p_party_id, p_party_site_id, p_party_type,
1465 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1466 );
1467
1468 wf_core.context('ECX_STANDARD','getXMLTP',transaction_type,transaction_subtype,party_id,party_site_id);
1469 wf_core.token('ECX_PARTY_ID', party_id);
1470 wf_core.token('ECX_PARTY_SITE_ID', party_site_id);
1471 wf_core.token('ECX_TRANSACTION_TYPE', transaction_type);
1472 wf_core.token('ECX_TRANSACTION_SUBTYPE', transaction_subtype);
1473 wf_core.raise('ECX_NO_PARTY_SETUP');
1474 when ecx_document.ecx_delivery_setup_error then
1475 ecx_errorlog.outbound_trigger
1476 (
1477 trigger_id, transaction_type, transaction_subtype,
1478 p_party_id, p_party_site_id, p_party_type,
1479 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1480 );
1481
1482 wf_core.context('ECX_STANDARD','getXMLTP',transaction_type,transaction_subtype,party_id,party_site_id);
1483 wf_core.token('ECX_PARTY_ID', party_id);
1484 wf_core.token('ECX_PARTY_SITE_ID', party_site_id);
1485 wf_core.token('ECX_TRANSACTION_TYPE', transaction_type);
1486 wf_core.token('ECX_TRANSACTION_SUBTYPE', transaction_subtype);
1487 wf_core.raise('ECX_DELIVERY_SETUP_ERROR');
1488 when ecx_utils.program_exit then
1489 ecx_errorlog.outbound_trigger
1490 (
1491 trigger_id, transaction_type, transaction_subtype,
1492 p_party_id, p_party_site_id, p_party_type,
1493 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1494 );
1495
1496 wf_core.context('ECX_STANDARD','getXMLTP',transaction_type,transaction_subtype,party_id,party_site_id);
1497 g_instlmode := wf_core.translate('WF_INSTALL');
1498 IF g_instlmode = 'EMBEDDED'
1499 THEN
1500 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(ecx_utils.i_errbuf,
1501 ecx_utils.i_errparams));
1502 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1503 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
1504 ELSE
1505 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(ecx_utils.i_errbuf,
1506 ecx_utils.i_errparams));
1507 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1508 wf_core.raise('ECX_PROGRAM_EXIT');
1509 END IF;
1510 when others then
1511 ecx_errorlog.outbound_trigger
1512 (
1513 trigger_id, transaction_type, transaction_subtype,
1514 p_party_id, p_party_site_id, p_party_type,
1515 document_id, ecx_utils.i_ret_code, ecx_utils.i_errbuf
1516 );
1517
1518 Wf_Core.Context('ECX_STANDARD', 'getXMLTP', itemtype, itemkey, to_char(actid), funcmode);
1519 raise;
1520 end getXMLTP;
1521
1522
1523 -- GetXML
1524 -- Standard ECX Workflow Activity
1525 -- Retrieve XML document
1526 -- OUT
1527 -- result - null
1528 --
1529 -- ACTIVITY ATTRIBUTES REFERENCED
1530 -- MAP_CODE - text value (required)
1531 -- DOCUMENT_ID - text value (required)
1532 -- EVENT_NAME - text value (optional)
1533 -- EVENT_KEY - text value (optional)
1534 -- PARAMETER1..5 - text value (optional)
1535 --
1536 -- EVENT_MESSAGE - Item ATTR (required)
1537 -- NOTE:
1538
1539 procedure GetXML(itemtype in varchar2,
1540 itemkey in varchar2,
1541 actid in number,
1542 funcmode in varchar2,
1543 resultout in out NOCOPY varchar2)
1544 is
1545 i_debug_level pls_integer :=0;
1546 i_map_code varchar2(200);
1547 retcode pls_integer;
1548 errmsg varchar2(2000);
1549 transaction_type varchar2(200);
1550 transaction_subtype varchar2(200);
1551 party_id number; /* Bug 2122579 */
1552 party_site_id number;
1553 document_id varchar2(240);
1554
1555 parameter1 varchar2(240);
1556 parameter2 varchar2(240);
1557 parameter3 varchar2(240);
1558 parameter4 varchar2(240);
1559 parameter5 varchar2(240);
1560
1561 /* Variabledeclarations for Bug 2120165*/
1562 i_evt wf_event_t;
1563 i_param_name varchar2(30);
1564 i_param_value varchar2(2000);
1565 counter number ;
1566 /* End of changes for bug 2120165*/
1567
1568 event_name varchar2(240);
1569 event_key varchar2(240);
1570 i_event wf_event_t;
1571 aevent_name varchar2(240);
1572 aname varchar2(30);
1573 evt_name varchar2(30);
1574 atype varchar2(8);
1575 aformat varchar2(240);
1576 asubtype varchar2(8);
1577 i_error_type pls_integer;
1578 dummy_number number;
1579 pECX_MAX_JAVA_MEMORY varchar2(30);
1580
1581
1582 begin
1583
1584 fnd_profile.get('ECX_MAX_JAVA_MEMORY',pECX_MAX_JAVA_MEMORY);
1585
1586 if pECX_MAX_JAVA_MEMORY is null then
1587 dummy_number:= setMaxJavaMemorySize(MAX_JAVA_MEMORY); -- bug 6889689
1588 else
1589 dummy_number:= setMaxJavaMemorySize( to_number(pECX_MAX_JAVA_MEMORY) * 1024 * 1024 ); -- bug 7121350
1590 end if;
1591
1592
1593 -- Set the Global itemtype,itemkey and the activity_id
1594 ecx_utils.g_item_type := itemtype;
1595 ecx_utils.g_item_key := itemkey;
1596 ecx_utils.g_activity_id := actid;
1597
1598 -- Do nothing in cancel or timeout mode
1599 if (funcmode <> wf_engine.eng_run) then
1600 resultout := wf_engine.eng_null;
1601 return;
1602 end if;
1603 i_map_code := Wf_Engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MAP_CODE');
1604 if (i_map_code is null ) then
1605 wf_core.token('ECX_MAP_CODE','NULL');
1606 wf_core.raise('WFSQL_ARGS');
1607 end if;
1608
1609
1610 document_id := Wf_Engine.GetActivityAttrTEXT(itemtype, itemkey, actid, 'ECX_DOCUMENT_ID');
1611 i_debug_level := nvl(Wf_Engine.GetItemAttrText(itemtype, itemkey, 'ECX_DEBUG_LEVEL',true),0);
1612 event_name := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_EVENT_NAME');
1613 event_key := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_EVENT_KEY');
1614
1615 /* Start changes for bug Bug 2120165 */
1616 parameter1 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER1');
1617 parameter2 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER2');
1618 parameter3 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER3');
1619 parameter4 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER4');
1620 parameter5 := Wf_Engine.GetActivityAttrText(itemtype, itemkey,actid, 'ECX_PARAMETER5');
1621
1622 -- Verify that the attr type = EVENT
1623
1624 evt_name := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_EVENT_MESSAGE');
1625 if ( evt_name is null ) then
1626 wf_core.token('ECX_EVENT_MESSAGE','NULL');
1627 wf_core.raise('WFSQL_ARGS');
1628 end if;
1629
1630 Wf_Engine.GetItemAttrInfo(itemtype, evt_name ,atype, asubtype, aformat);
1631 if (atype <> 'EVENT' ) then
1632 wf_core.token('VTYPE',atype);
1633 wf_core.raise('WFXXXV_VTYPE');
1634 end if;
1635
1636 i_event := Wf_Engine.GetItemAttrEvent(itemtype, itemkey, evt_name);
1637
1638 /**
1639 Populate the Parameters in the original event Object being passed. if it is null , initialize and create
1640 a new Instance and populate the variables
1641 if i_event is null
1642 then
1643 wf_event_t.initialize(ecx_utils.g_event);
1644 else
1645 ecx_utils.g_event := i_event;
1646 end if;
1647 **/
1648
1649 /*Always initialize ecx_utils.g_event before using it */
1650 wf_event_t.initialize(ecx_utils.g_event);
1651 if i_event is not null
1652 then
1653 ecx_utils.g_event := i_event;
1654 End If;
1655
1656
1657 -- Add the above Parameters to the Global Event Message Object
1658 -- For backward compatability , we are passing ECX_PARAMETER1 -> PARAMETER1 on the Engine.
1659 ecx_utils.g_event.addparametertolist('PARAMETER1',parameter1);
1660 ecx_utils.g_event.addparametertolist('PARAMETER2',parameter2);
1661 ecx_utils.g_event.addparametertolist('PARAMETER3',parameter3);
1662 ecx_utils.g_event.addparametertolist('PARAMETER4',parameter4);
1663 ecx_utils.g_event.addparametertolist('PARAMETER5',parameter5);
1664
1665 -- KH comment: is null values for TP info going to casue an issue in GetXMLCover
1666 getXMLcover(i_map_code => i_map_code,
1667 i_transaction_type => transaction_type,
1668 i_transaction_subtype => transaction_subtype,
1669 i_tp_id => party_id,
1670 i_tp_site_id => party_site_id,
1671 i_document_id => document_id,
1672 i_debug_level => i_debug_level,
1673 i_xmldoc => ecx_utils.g_event.event_data
1674 );
1675
1676 -- Populate event structure and set item attribute
1677
1678 if event_name is not null
1679 then
1680 i_event.SetEventName(event_name);
1681 end if;
1682
1683 if event_key is not null
1684 then
1685 i_event.SetEventKey(event_key);
1686 end if;
1687
1688 -- set the event data back
1689 wf_engine.SetItemAttrEvent(itemtype, itemkey, evt_name, ecx_utils.g_event);
1690
1691 addItemAttributes(itemtype,itemkey);
1692
1693 resultout := 'COMPLETE:';
1694
1695 exception
1696 when others then
1697 Wf_Core.Context('ECX_STANDARD', 'getXML', itemtype, itemkey, to_char(actid), funcmode);
1698 raise;
1699 end getXML;
1700
1701
1702
1703 procedure Reprocess_Inbound
1704 (
1705 itemtype in varchar2,
1706 itemkey in varchar2,
1707 actid in number,
1708 funcmode in varchar2,
1709 result in out NOCOPY varchar2
1710 )
1711 is
1712 message_id varchar2(200);
1713 retcode pls_integer;
1714 errmsg varchar2(2000);
1715 debug_level pls_integer :=0;
1716 trigger_id pls_integer;
1717 error_type pls_integer;
1718 aname varchar2(200);
1719 aname_trigger_id varchar2(200);
1720 aname_error_type varchar2(200);
1721 aname_logfile varchar2(200);
1722 g_instlmode varchar2(100);
1723 begin
1724
1725 -- Set the Global itemtype,itemkey and the activity_id
1726 ecx_utils.g_item_type := itemtype;
1727 ecx_utils.g_item_key := itemkey;
1728 ecx_utils.g_activity_id := actid;
1729
1730 -- RUN mode - normal process execution
1731
1732 if (funcmode = 'RUN') then
1733
1734 message_id := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MSGID');
1735 debug_level := nvl(Wf_Engine.GetItemAttrText(itemtype, itemkey,'ECX_DEBUG_LEVEL',true),0);
1736
1737 ecx_inbound_trig.reprocess
1738 (
1739 i_msgid => message_id,
1740 i_debug_level => debug_level,
1741 i_trigger_id => trigger_id,
1742 i_retcode => retcode,
1743 i_errbuf => errmsg
1744 );
1745
1746 aname_trigger_id := wf_engine.GetItemAttrText(itemtype, itemkey, 'ECX_TRIGGER_ID',true);
1747
1748 if aname_trigger_id is not null
1749 then
1750 wf_engine.SetItemAttrNumber(itemtype,itemkey,aname_trigger_id,trigger_id);
1751 end if;
1752
1753
1754 addItemAttributes(itemtype,itemkey);
1755
1756 if retcode = 0
1757 then
1758 result := 'COMPLETE:';
1759 return;
1760 elsif retcode = 1
1761 then
1762 g_instlmode := wf_core.translate('WF_INSTALL');
1763 IF g_instlmode = 'EMBEDDED'
1764 THEN
1765 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1766 ecx_utils.i_errparams));
1767 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1768 wf_core.raise('ECX_REPROCESS_INBOUND_EMBD');
1769 ELSE
1770 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1771 ecx_utils.i_errparams));
1772 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1773 wf_core.raise('ECX_REPROCESS_INBOUND');
1774 END IF;
1775
1776 else
1777 g_instlmode := wf_core.translate('WF_INSTALL');
1778 IF g_instlmode = 'EMBEDDED'
1779 THEN
1780 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1781 ecx_utils.i_errparams));
1782 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1783 wf_core.raise('ECX_PROGRAM_EXIT_EMBD');
1784 ELSE
1785 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1786 ecx_utils.i_errparams));
1787 wf_core.token('ECX_LOGFILE',ecx_utils.g_logfile);
1788 wf_core.raise('ECX_PROGRAM_EXIT');
1789 END IF;
1790 end if;
1791
1792 result := 'COMPLETE:';
1793 return;
1794
1795 end if;
1796
1797
1798 -- CANCEL mode - activity 'compensation'
1799 --
1800 -- This is in the event that the activity must be undone,
1801 -- for example when a process is reset to an earlier point
1802 -- due to a loop back.
1803
1804 if (funcmode = 'CANCEL') then
1805
1806 -- your cancel code goes here
1807 null;
1808
1809 -- no result needed
1810 result := 'COMPLETE:';
1811 return;
1812 end if;
1813
1814
1815
1816 -- Other execution modes may be created in the future. Your
1817 -- activity will indicate that it does not implement a mode
1818 -- by returning null
1819
1820 result := '';
1821 return;
1822
1823 exception
1824 when others then
1825 wf_core.context('ECX_STANDARD', 'Reprocess_Inbound',itemtype, itemkey, to_char(actid),funcmode,retcode, errmsg);
1826 raise;
1827 end Reprocess_Inbound;
1828
1829 procedure resend
1830 (
1831 itemtype in varchar2,
1832 itemkey in varchar2,
1833 actid in number,
1834 funcmode in varchar2,
1835 result in out NOCOPY varchar2
1836 )
1837 is
1838 message_id varchar2(200);
1839 retcode pls_integer;
1840 errmsg varchar2(2000);
1841 begin
1842
1843 -- Set the Global itemtype,itemkey and the activity_id
1844 ecx_utils.g_item_type := itemtype;
1845 ecx_utils.g_item_key := itemkey;
1846 ecx_utils.g_activity_id := actid;
1847
1848
1849 -- RUN mode - normal process execution
1850
1851 if (funcmode = 'RUN') then
1852
1853 message_id := wf_engine.GetActivityAttrText(itemtype, itemkey, actid, 'ECX_MSGID');
1854
1855 ecx_document.resend
1856 (
1857 i_msgid => message_id,
1858 i_flag => 'Y',
1859 retcode => retcode,
1860 errmsg => errmsg
1861 );
1862
1863
1864 if retcode = 0
1865 then
1866 result := 'COMPLETE:';
1867 return;
1868 elsif retcode = 1
1869 then
1870 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1871 ecx_utils.i_errparams));
1872 wf_core.raise('ECX_RESEND_WARNING');
1873 else
1874 wf_core.token('ECX_ERRMSG',ecx_debug.getMessage(errmsg,
1875 ecx_utils.i_errparams));
1876 wf_core.raise('ECX_RESEND_ERROR');
1877 end if;
1878
1879 result := 'COMPLETE:';
1880 return;
1881
1882 end if;
1883
1884
1885 -- CANCEL mode - activity 'compensation'
1886
1887 -- This is in the event that the activity must be undone,
1888 -- for example when a process is reset to an earlier point
1889 -- due to a loop back.
1890
1891 if (funcmode = 'CANCEL') then
1892
1893 -- your cancel code goes here
1894 null;
1895
1896 -- no result needed
1897 result := 'COMPLETE:';
1898 return;
1899 end if;
1900
1901
1902
1903 -- Other execution modes may be created in the future. Your
1904 -- activity will indicate that it does not implement a mode
1905 -- by returning null
1906
1907 result := '';
1908 return;
1909
1910 exception
1911 when others then
1912 wf_core.context('ECX_STANDARD', 'ReSend',itemtype, itemkey, to_char(actid),funcmode,retcode, ecx_debug.getMessage(errmsg,ecx_utils.i_errparams));
1913 raise;
1914 end resend;
1915
1916 -- getEventDetails (PUBLIC)
1917 -- Standard XML Gateway Event API
1918 -- OUT:
1919 -- eventname - Event to the processes
1920 -- eventkey - Event key
1921 -- NOTE:
1922 -- Called from the MD maintained as a GLobal parameter by the XML gateway engine
1923
1924 procedure getEventDetails
1925 (
1926 eventname out NOCOPY varchar2,
1927 eventkey out NOCOPY varchar2,
1928 itemtype out NOCOPY varchar2,
1929 itemkey out NOCOPY varchar2,
1930 parentitemtype out NOCOPY varchar2,
1931 parentitemkey out NOCOPY varchar2,
1932 retcode OUT NOCOPY pls_integer,
1933 retmsg OUT NOCOPY varchar2
1934 )
1935 is
1936 i_string varchar2(2000);
1937 i_start_pos pls_integer;
1938 p_parameter_list wf_parameter_list_t;
1939 begin
1940 retcode :=0;
1941 retmsg :=null;
1942
1943 eventname := null;
1944 eventkey := null;
1945 itemtype := null;
1946 itemkey := null;
1947 parentitemtype := null;
1948 parentitemkey := null;
1949
1950 if ecx_utils.g_event is not null
1951 then
1952 eventname := ecx_utils.g_event.event_name;
1953 eventkey := ecx_utils.g_event.event_key;
1954 itemtype := ecx_utils.g_item_type;
1955 itemkey := ecx_utils.g_item_key;
1956
1957 p_parameter_list := ecx_utils.g_event.parameter_list;
1958 if p_parameter_list is not null
1959 then
1960 i_string := wf_event.getValueForParameter('#CONTEXT',p_parameter_list);
1961 if i_string is not null
1962 then
1963 i_start_pos := instrb(i_string,':',1,1);
1964 parentitemtype := substr(i_string,1,i_start_pos-1);
1965 parentitemkey := substr(i_string,i_start_pos+1,length(i_string));
1966 end if;
1967 end if;
1968 end if;
1969
1970 exception
1971 when others then
1972 retcode := 2;
1973 retmsg := substr(SQLERRM,1,200);
1974 end getEventDetails;
1975
1976 -- getEventDetails (PUBLIC)
1977 -- Standard XML Gateway Event API
1978 -- OUT:
1979 -- eventname - Event to the processes
1980 -- eventkey - Event key
1981 -- NOTE:
1982 -- Called from the MD maintained as a GLobal parameter by the XML gateway engine
1983 procedure getEventSystem
1984 (
1985 from_agent out NOCOPY varchar2,
1986 to_agent out NOCOPY varchar2,
1987 from_system out NOCOPY varchar2,
1988 to_system out NOCOPY varchar2,
1989 retcode OUT NOCOPY pls_integer,
1990 retmsg OUT NOCOPY varchar2
1991 )
1992 is
1993 begin
1994 retcode :=0;
1995 retmsg :=null;
1996 from_agent := null;
1997 to_agent := null;
1998 from_system := null;
1999 to_system := null;
2000
2001 if ecx_utils.g_event is not null
2002 then
2003 if ecx_utils.g_event.from_agent is not null
2004 then
2005 from_agent := ecx_utils.g_event.from_agent.name;
2006 from_system := ecx_utils.g_event.from_agent.system;
2007 else
2008 -- Use the Local System
2009 from_system := wf_event.local_system_name;
2010 end if;
2011
2012 if ecx_utils.g_event.to_agent is not null
2013 then
2014 to_agent := ecx_utils.g_event.to_agent.name;
2015 to_system := ecx_utils.g_event.to_agent.system;
2016 else
2017 -- Use the Local System
2018 from_system := wf_event.local_system_name;
2019 end if;
2020 end if;
2021
2022 exception
2023 when others then
2024 retcode := 2;
2025 retmsg := substr(SQLERRM,1,200);
2026 end getEventSystem;
2027
2028 function getReferenceId
2029 return varchar2
2030 is
2031 i_eventname varchar2(240);
2032 i_eventkey varchar2(240);
2033 i_itemtype varchar2(8);
2034 i_itemkey varchar2(240);
2035 i_parentitemtype varchar2(8);
2036 i_parentitemkey varchar2(240);
2037 i_from_system varchar2(240);
2038 i_retcode pls_integer;
2039 i_retmsg varchar2(2000);
2040
2041 begin
2042 getEventDetails
2043 (
2044 eventname => i_eventname,
2045 eventkey => i_eventkey,
2046 itemtype => i_itemtype,
2047 itemkey => i_itemkey,
2048 parentitemtype => i_parentitemtype,
2049 parentitemkey => i_parentitemkey,
2050 retcode => i_retcode,
2051 retmsg => i_retmsg
2052 );
2053
2054 if ecx_utils.g_event.from_agent is not null
2055 then
2056 i_from_system := ecx_utils.g_event.from_agent.system;
2057 else
2058 i_from_system := wf_event.local_system_name;
2059 end if;
2060
2061 return i_from_system||':'||i_eventname||':'||i_eventkey;
2062
2063 end getReferenceId;
2064
2065 /**
2066 This API enables user to perform XSLT transformation on a any given xml file
2067 **/
2068 procedure perform_xslt_transformation
2069 (
2070 i_xml_file in out NOCOPY clob,
2071 i_xslt_file_name in varchar2,
2072 i_xslt_file_ver in varchar2,
2073 i_xslt_application_code in varchar2,
2074 i_retcode out NOCOPY pls_integer,
2075 i_retmsg out NOCOPY varchar2,
2076 i_dtd_file_name in varchar2,
2077 i_dtd_root_element in varchar2,
2078 i_dtd_version in varchar2
2079 )
2080 is
2081 l_parser xmlparser.parser;
2082 l_xml_doc xmlDOM.DOMDocument;
2083 i_version number;
2084 l_dtd_payload clob;
2085 l_doctype xmlDOM.DOMDocumentType;
2086
2087 cursor get_dtd is
2088 select payload
2089 from ecx_dtds
2090 where filename = i_dtd_file_name
2091 and root_element = i_dtd_root_element
2092 and (version = i_dtd_version or i_dtd_version is null);
2093
2094 begin
2095 -- check for nulls
2096 if (i_xml_file is null)
2097 then
2098 i_retcode := 2;
2099 i_retmsg := ecx_debug.getTranslatedMessage('ECX_XML_FILE_NULL');
2100 return;
2101 end if;
2102
2103 if(i_xslt_file_name is null)
2104 then
2105 i_retcode := 2;
2106 i_retmsg := ecx_debug.getTranslatedMessage('ECX_XSLT_FILE_NULL');
2107 return;
2108 end if;
2109
2110 if (i_xslt_application_code is null)
2111 then
2112 i_retcode := 2;
2113 i_retmsg := ecx_debug.getTranslatedMessage('ECX_XSLT_APP_CODE_NULL');
2114 return;
2115 end if;
2116
2117 -- if version is null, select the max version for the provided
2118 -- details. If max version does not exists assume version to be 0.0
2119 if (i_xslt_file_ver is null)
2120 then
2121 begin
2122 select max(version)
2123 into i_version
2124 from ecx_files
2125 where application_code = i_xslt_application_code
2126 and name = i_xslt_file_name
2127 and type = 'XSLT';
2128 exception
2129 when others then
2130 i_version := 0.0;
2131 end;
2132 else
2133 i_version := to_number(i_xslt_file_ver,'999999999999999.999');
2134 end if;
2135
2136 -- get dtd information
2137 if (not (i_dtd_file_name is null) AND not (i_dtd_root_element is null))
2138 then
2139 open get_dtd;
2140 fetch get_dtd
2141 into l_dtd_payload;
2142 close get_dtd;
2143 end if;
2144
2145 -- convert i_xml_file from CLOB to DOMNode and set in ecx_utils.g_xmldoc
2146 l_parser := xmlparser.newParser;
2147
2148 if (l_dtd_payload is not null)
2149 then
2150 -- set the dtd in the parser instance
2151 xmlparser.parseDTDCLOB(l_parser, l_dtd_payload, i_dtd_root_element);
2152 xmlparser.setValidationMode (l_parser, true);
2153 l_doctype := xmlparser.getDocType (l_parser);
2154 xmlparser.setDocType (l_parser, l_doctype);
2155 end if;
2156
2157 xmlparser.parseCLOB(l_parser, i_xml_file);
2158
2159 l_xml_doc := xmlparser.getDocument(l_parser);
2160
2161 ecx_utils.g_xmldoc := xmlDOM.makeNode(l_xml_doc);
2162
2163 -- call transform_xml_with_xslt to do the transformation
2164 ecx_actions.transform_xml_with_xslt (i_xslt_file_name,
2165 i_version,
2166 i_xslt_application_code
2167 );
2168 -- get the transformed xml from ecx_utils.g_xml_doc
2169 -- convert from DOMNode to clob and set it in original xmlfile
2170
2171 /* Bug #2517237 : Trim the Clob before writing the transformed xml */
2172 dbms_lob.trim(i_xml_file, 0);
2173
2174 xmlDOM.writeToClob(ecx_utils.g_xmldoc, i_xml_file);
2175
2176 -- free all the used variables
2177 l_dtd_payload := null;
2178 xmlparser.freeParser(l_parser);
2179 ecx_utils.g_xmldoc := null;
2180 ecx_utils.g_logdir := null;
2181 ecx_utils.g_logfile := null;
2182 if (not xmldom.isNull(l_xml_doc))
2183 then
2184 xmldom.freeDocument(l_xml_doc);
2185 end if;
2186
2187 i_retcode := 0;
2188 i_retmsg := ecx_debug.getTranslatedMessage('ECX_XSLT_TRANSFORMED');
2189
2190 exception
2191 when ecx_utils.program_exit then
2192 i_retcode := ecx_utils.i_ret_code;
2193 i_retmsg := ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams);
2194
2195 -- free all the used variables
2196 l_dtd_payload := null;
2197 xmlparser.freeParser(l_parser);
2198 ecx_utils.g_xmldoc := null;
2199 ecx_utils.g_logdir := null;
2200 ecx_utils.g_logfile := null;
2201 ecx_utils.i_ret_code := 0;
2202 ecx_utils.i_errbuf := null;
2203 ecx_utils.i_errparams := null;
2204 if (not xmldom.isNull(l_xml_doc))
2205 then
2206 xmldom.freeDocument(l_xml_doc);
2207 end if;
2208 when others then
2209 i_retmsg:= SQLERRM || ' - ECX_STANDARD.PERFORM_XSLT_TRANSFORMATION';
2210 i_retcode := 2;
2211
2212 -- free all the used variables
2213 l_dtd_payload := null;
2214 xmlparser.freeParser(l_parser);
2215 ecx_utils.g_xmldoc := null;
2216 ecx_utils.g_logdir := null;
2217 ecx_utils.g_logfile := null;
2218 ecx_utils.i_ret_code := 0;
2219 ecx_utils.i_errbuf := null;
2220 ecx_utils.i_errparams := null;
2221 if (not xmldom.isNull(l_xml_doc))
2222 then
2223 xmldom.freeDocument(l_xml_doc);
2224 end if;
2225 end perform_xslt_transformation;
2226
2227
2228
2229 /** bug 3357213 */
2230 -- -------------------------------------------------------------------------------------------
2231 -- API name : GET_VALUE_FOR_XPATH
2232 --
2233 -- Type : Public
2234 --
2235 -- Pre-reqs : None
2236 --
2237 -- Function : Returns Value of the Node from the XML Document for the specified XPATH.
2238 -- Incase of multiple occurrences, a list of comma-separated values is returned
2239 --
2240 -- Parameters
2241 -- IN : p_api_version IN NUMBER
2242 -- : p_XML_DOCUMENT IN CLOB
2243 -- : p_XPATH_EXPRESSION IN VARCHAR2
2244 --
2245 -- OUT : x_return_status OUT VARCHAR2
2246 -- : x_msg_data OUT VARCHAR2
2247 -- : x_XPATH_VALUE OUT VARCHAR2
2248 --
2249 -- Version : Current version 1.0
2250 -- Initial version 1.0
2251 --
2252 -- Notes :
2253 --
2254 -- -------------------------------------------------------------------------------------------
2255
2256 PROCEDURE GET_VALUE_FOR_XPATH (
2257 p_api_version IN NUMBER,
2258 x_return_status OUT NOCOPY VARCHAR2,
2259 x_msg_data OUT NOCOPY VARCHAR2,
2260 p_XML_DOCUMENT IN CLOB,
2261 p_XPATH_EXPRESSION IN VARCHAR2,
2262 x_XPATH_VALUE OUT NOCOPY VARCHAR2
2263 )
2264 IS
2265 l_api_version CONSTANT NUMBER := 1.0;
2266 l_api_name CONSTANT VARCHAR2(30) := 'GET_VALUE_FOR_XPATH';
2267
2268 l_parser XMLPARSER.PARSER;
2269 l_dom_document XMLDOM.DOMDOCUMENT;
2270 l_node_list XMLDOM.DOMNODELIST;
2271 l_node XMLDOM.DOMNODE;
2272
2273 INVALID_NODE_IN_NODELIST EXCEPTION;
2274 BEGIN
2275 -- Standard call to check for call compatibility
2276 IF NOT fnd_api.Compatible_API_Call ( l_api_version, p_api_version, l_api_name, G_PKG_NAME )
2277 THEN RAISE fnd_api.G_EXC_UNEXPECTED_ERROR;
2278 END IF;
2279
2280 --Initialize API return status to success
2281 x_return_status := FND_API.G_RET_STS_SUCCESS;
2282
2283 --Associate a new instance of XML Parser
2284 l_parser := XMLPARSER.newParser;
2285
2286 --Attach the XML Clob to the XML Parser
2287 XMLPARSER.parseClob(l_parser, p_XML_DOCUMENT);
2288
2289 --Obtain the XML Clob in DOM Document Format
2290 l_dom_document := XMLPARSER.getDocument(l_parser);
2291 XMLParser.freeParser(l_parser);
2292
2293 --Obtain the nodes, present at the location specified by the XPATH Expression
2294 l_node_list := XSLPROCESSOR.selectNodes(XMLDOM.makeNode(l_dom_document),p_XPATH_EXPRESSION);
2295
2296 FOR i IN 1..XMLDOM.getLength(l_node_list) LOOP
2297 -- Fetch node with index (i-1) from nodelist
2298 l_node := XMLDOM.ITEM(l_node_list, i-1);
2299
2300 --If no nodes are present raise error
2301 IF (XMLDOM.isNull(l_node)) THEN
2302 RAISE INVALID_NODE_IN_NODELIST;
2303 END IF;
2304
2305 --Check if current node has any child nodes
2306 IF XMLDOM.hasChildNodes(l_node) THEN
2307 l_node := XMLDOM.getFirstChild(l_node);
2308 LOOP
2309 IF XMLDOM.getNodeType(l_node) = XMLDOM.TEXT_NODE THEN
2310 -- Append x_XPATH_VALUE with Previous x_XPATH_VALUE and
2311 -- include a comma at the end to generate a list of comma separated values.
2312 x_XPATH_VALUE := x_XPATH_VALUE || TRIM(XMLDOM.getNodeValue(l_node)) || ',';
2313 EXIT;
2314 END IF;
2315
2316 l_node := XMLDOM.getNextSibling(l_node);
2317 EXIT WHEN XMLDOM.isNull(l_node);
2318 END LOOP;
2319 END IF;
2320
2321 END LOOP;
2322
2323 --Removing the extra comma from the end of the string
2324 x_XPATH_VALUE := SUBSTR(x_XPATH_VALUE, 0, LENGTH(x_XPATH_VALUE)-1);
2325 XMLDOM.freeDocument(l_dom_document);
2326
2327 EXCEPTION
2328 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2329 x_XPATH_VALUE := NULL;
2330 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2331
2332 x_msg_data := 'G_EXC_UNEXPECTED_ERROR';
2333 fnd_message.Set_Name( 'EDR', 'EDR_PLS_STDMSG_GENERATED' );
2334 fnd_message.Set_Token( 'ERR_CODE', SQLCODE );
2335 fnd_message.Set_Token( 'ERR_MESG', SQLERRM );
2336 fnd_msg_pub.Add;
2337
2338 WHEN INVALID_NODE_IN_NODELIST THEN
2339 x_XPATH_VALUE := NULL;
2340 x_return_status := FND_API.G_RET_STS_ERROR;
2341
2342 x_msg_data := 'INVALID_NODE_IN_NODELIST';
2343 fnd_message.Set_Name( 'EDR', 'EDR_PLS_STDMSG_GENERATED' );
2344 fnd_message.Set_Token( 'ERR_CODE', SQLCODE );
2345 fnd_message.Set_Token( 'ERR_MESG', SQLERRM );
2346 fnd_msg_pub.Add;
2347
2348 WHEN OTHERS THEN
2349 x_XPATH_VALUE := NULL;
2350 IF SQLCODE = PROCESSOR_ERR THEN
2351 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2352
2353 x_msg_data := 'PROCESSOR_ERR';
2354 fnd_message.Set_Name( 'EDR', 'EDR_PLS_STDMSG_GENERATED' );
2355 fnd_message.Set_Token( 'ERR_CODE', SQLCODE );
2356 fnd_message.Set_Token( 'ERR_MESG', SQLERRM );
2357 fnd_msg_pub.Add;
2358 ELSIF SQLCODE = NULL_ERR THEN
2359 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2360
2361 x_msg_data := 'NULL_ERR';
2362 fnd_message.Set_Name( 'EDR', 'EDR_PLS_STDMSG_GENERATED' );
2363 fnd_message.Set_Token( 'ERR_CODE', SQLCODE );
2364 fnd_message.Set_Token( 'ERR_MESG', SQLERRM );
2365 fnd_msg_pub.Add;
2366 ELSE
2367 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2368
2369 x_msg_data := 'EDR_PLS_STDMSG_UNEXPECTED';
2370 fnd_message.Set_Name( 'EDR', 'EDR_PLS_STDMSG_GENERATED' );
2371 fnd_message.Set_Token( 'ERR_CODE', SQLCODE );
2372 fnd_message.Set_Token( 'ERR_MESG', SQLERRM );
2373 fnd_msg_pub.Add;
2374 END IF;
2375 END GET_VALUE_FOR_XPATH;
2376
2377 /** bug 3357213 */
2378
2379 end ecx_standard;