[Home] [Help]
PACKAGE BODY: APPS.ECX_INBOUND_TRIG
Source
1 package body ecx_inbound_trig as
2 -- $Header: ECXINBTB.pls 120.16.12000000.3 2007/09/18 15:35:00 cpeixoto ship $
3
4 l_procedure PLS_INTEGER := ecx_debug.g_procedure;
5 l_statement PLS_INTEGER := ecx_debug.g_statement;
6 l_unexpected PLS_INTEGER := ecx_debug.g_unexpected;
7 l_procedureEnabled boolean := ecx_debug.g_procedureEnabled;
8 l_statementEnabled boolean := ecx_debug.g_statementEnabled;
9 l_unexpectedEnabled boolean := ecx_debug.g_unexpectedEnabled;
10
11 TYPE attribute_rec is RECORD
12 (
13 attribute_name varchar2(256),
14 element_tag_name varchar2(256),
15 value varchar2(4000)
16 );
17
18 TYPE attr_tbl is TABLE of attribute_rec index by BINARY_INTEGER;
19 /** Define the local variable for storing the attributes with the values **/
20 i_attr_rec attr_tbl;
21
22
23 function is_routing_supported
24 (
25 p_map_id IN pls_integer
26 ) return boolean is
27
28 l_tar_obj_type Varchar2(200);
29 i_method_name varchar2(2000):='ecx_inbound_trig.is_routing_supported';
30
31 begin
32 SELECT object_type
33 INTO l_tar_obj_type
34 FROM ecx_objects
35 WHERE map_id = p_map_id
36 AND object_id = 2;
37
38 if (l_tar_obj_type = 'DB') then
39 return false;
40 else
41 return true;
42 end if;
43
44 exception
45 when others then
46 ecx_debug.setErrorInfo(2, 30,
47 SQLERRM||' - ECX_INBOUND_TRIG.IS_ROUTING_SUPPORTED');
48 if(l_unexpectedEnabled) then
49 --ecx_debug.log(l_statement, ecx_utils.i_errbuf, i_method_name);
50 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
51 end if;
52 raise ecx_utils.program_exit;
53 end is_routing_supported;
54
55
56 procedure get_element_value
57 (
58 i_doc IN xmlDOM.DOMDocument,
59 i_element IN varchar2,
60 i_value OUT NOCOPY varchar2
61 )
62 is
63
64
65 i_method_name varchar2(2000) := 'ecx_inbound_trig.get_element_value';
66 nl xmlDOM.DOMNodeList := null;
67 n pls_integer;
68 pnode xmlDOM.DOMNode;
69 cnode xmlDOM.DOMNode;
70 begin
71 if (l_procedureEnabled) then
72 ecx_debug.push(i_method_name);
73 end if;
74 if(l_statementEnabled) then
75 ecx_debug.log(l_statement,'i_doc',i_doc.id,i_method_name);
76 ecx_debug.log(l_statement,'i_element',i_element,i_method_name);
77 end if;
78 nl := xmlDOM.getElementsByTagName(i_doc,i_element);
79
80 if (not xmlDOM.isNull(nl))
81 then
82 n := xmlDOM.getLength(nl);
83 if n > 0
84 then
85 pnode := xmlDOM.item(nl,0);
86 cnode := xmlDOM.getFirstChild(pnode);
87 if (not xmlDOM.isNull(cnode))
88 then
89 i_value := xmlDOM.getNodeValue(cnode);
90 end if;
91 end if;
92 end if;
93 if(l_statementEnabled) then
94 ecx_debug.log(l_statement,'i_value',i_value,i_method_name);
95 end if;
96 if (l_procedureEnabled) then
97 ecx_debug.pop(i_method_name);
98 end if;
99 exception
100 when others then
101 ecx_debug.setErrorInfo(2,30,
102 SQLERRM ||' - ECX_INBOUND_TRIG.GET_ELEMENT_VALUE');
103 if(l_unexpectedEnabled) then
104 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
105 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
106 end if;
107 raise ecx_utils.program_exit;
108 end get_element_value;
109
110 procedure getAttributes
111 (
112 i_standard_code in varchar2,
113 i_doc IN xmlDOM.DOMDocument,
114 i_standard_type in varchar2
115 )
116 is
117
118 i_method_name varchar2(2000) := 'ecx_inbound_trig.get_element_value';
119 cursor get_attributes
120 (
121 p_standard_code IN varchar2,
122 p_standard_type IN varchar2
123 )
124 is
125 select attribute_name,
126 element_tag_name
127 from ecx_standard_attributes esa,
128 ecx_standards es
129 where es.standard_code = p_standard_code
130 and es.standard_type = nvl(p_standard_type, 'XML')
131 and esa.standard_id = es.standard_id;
132
133 i_string varchar2(2000) := ' update ecx_doclogs set ';
134
135 i_value varchar2(2000);
136
137 i_single varchar2(3):= '''';
138 begin
139 if (l_procedureEnabled) then
140 ecx_debug.push(i_method_name);
141 end if;
142 if(l_statementEnabled) then
143 ecx_debug.log(l_statement,'i_standard_code',i_standard_code,i_method_name);
144 end if;
145
146 if i_standard_code is null
147 then
148 if (l_procedureEnabled) then
149 ecx_debug.pop(i_method_name);
150 end if;
151 return;
152 end if;
153 /** Initialize the attr table **/
154 i_attr_rec.DELETE;
155
156 /** Get all the Attributes and capture the value **/
157 for c1 in get_Attributes(p_standard_code=>i_standard_code, p_standard_type =>i_standard_type)
158 loop
159 if ( c1.attribute_name is not null and c1.element_tag_name is not null)
160 then
161 i_attr_rec(i_attr_rec.COUNT + 1).attribute_name := c1.attribute_name;
162 i_attr_rec(i_attr_rec.COUNT).element_tag_name := c1.element_tag_name;
163
164 /** Search for the attribute in the XML File **/
165 get_element_value(i_doc,c1.element_tag_name,i_attr_rec(i_attr_rec.COUNT).value);
166 if(l_statementEnabled) then
167 ecx_debug.log(l_statement,i_attr_rec(i_attr_rec.COUNT).attribute_name,
168 i_attr_rec(i_attr_rec.COUNT).value,i_method_name);
169 end if;
170 i_string := i_string ||' '||i_attr_rec(i_attr_rec.COUNT).attribute_name || ' = '||
171 i_single||i_attr_rec(i_attr_rec.COUNT).value || i_single||' ,';
172 end if;
173 end loop;
174
175 /** remove the last , and put the statement for the where clause **/
176 i_string := substr(i_string,1,length(i_string)-1);
177 i_string := i_string || ' where msgid = '||i_single||ecx_utils.g_msgid||i_single;
178
179 if i_attr_rec.count > 0
180 then
181 if(l_statementEnabled) then
182 ecx_debug.log(l_statement,'i_string',i_string,i_method_name);
183 end if;
184 execute immediate i_string;
185 end if;
186 if (l_procedureEnabled) then
187 ecx_debug.pop(i_method_name);
188 end if;
189 exception
190 when others then
191 ecx_debug.setErrorInfo(2,30,SQLERRM ||' - ECX_INBOUND_TRIG.getAttributes');
192 if(l_unexpectedEnabled) then
193 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
194 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
195 end if;
196 raise ecx_utils.program_exit;
197 end getAttributes;
198
199 /**
200 For BES - removed send_error
201 **/
202
203 procedure parsepayload
204 (
205 i_payload IN CLOB
206 )
207 is
208
209 i_method_name varchar2(2000) := 'ecx_inbound_trig.parsepayload';
210 begin
211 if (l_procedureEnabled) then
212 ecx_debug.push(i_method_name);
213 end if;
214 xmlparser.parseCLOB(ecx_utils.g_parser,i_payload);
215 if (l_procedureEnabled) then
216 ecx_debug.pop(i_method_name);
217 end if;
218 exception
219 -- Put All DOM Parser Exceptions Here.
220 when xmlDOM.INDEX_SIZE_ERR then
221 ecx_debug.setErrorInfo(1,20,SQLERRM);
222 if(l_unexpectedEnabled) then
223 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
224 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
225 end if;
226 if (l_procedureEnabled) then
227 ecx_debug.pop(i_method_name);
228 end if;
229 raise ecx_utils.program_exit;
230 when xmlDOM.DOMSTRING_SIZE_ERR then
231 ecx_debug.setErrorInfo(1,20,SQLERRM);
232 if(l_unexpectedEnabled) then
233 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
234 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
235 end if;
236 if (l_procedureEnabled) then
237 ecx_debug.pop(i_method_name);
238 end if;
239 raise ecx_utils.program_exit;
240 when xmlDOM.HIERARCHY_REQUEST_ERR then
241 ecx_debug.setErrorInfo(1,20,SQLERRM);
242 if(l_unexpectedEnabled) then
243 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
244 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
245 end if;
246 if (l_procedureEnabled) then
247 ecx_debug.pop(i_method_name);
248 end if;
249 raise ecx_utils.program_exit;
250 when xmlDOM.WRONG_DOCUMENT_ERR then
251 ecx_debug.setErrorInfo(1,20,SQLERRM);
252 if(l_unexpectedEnabled) then
253 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
254 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
255 end if;
256 if (l_procedureEnabled) then
257 ecx_debug.pop(i_method_name);
258 end if;
259 raise ecx_utils.program_exit;
260 when xmlDOM.INVALID_CHARACTER_ERR then
261 ecx_debug.setErrorInfo(1,20,SQLERRM);
262 if(l_unexpectedEnabled) then
263 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
264 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
265 end if;
266 if (l_procedureEnabled) then
267 ecx_debug.pop(i_method_name);
268 end if;
269 raise ecx_utils.program_exit;
270 when xmlDOM.NO_DATA_ALLOWED_ERR then
271 ecx_debug.setErrorInfo(1,20,SQLERRM);
272 if(l_unexpectedEnabled) then
273 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
274 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
275 end if;
276 if (l_procedureEnabled) then
277 ecx_debug.pop(i_method_name);
278 end if;
279 raise ecx_utils.program_exit;
280 when xmlDOM.No_MODIFICATION_ALLOWED_ERR then
281 ecx_debug.setErrorInfo(1,20,SQLERRM);
282 if(l_unexpectedEnabled) then
283 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
284 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
285 end if;
286 if (l_procedureEnabled) then
287 ecx_debug.pop(i_method_name);
288 end if;
289 raise ecx_utils.program_exit;
290 when xmlDOM.NOT_FOUND_ERR then
291 ecx_debug.setErrorInfo(1,20,SQLERRM);
292 if(l_unexpectedEnabled) then
293 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
294 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
295 end if;
296 if (l_procedureEnabled) then
297 ecx_debug.pop(i_method_name);
298 end if;
299 raise ecx_utils.program_exit;
300 when xmlDOM.NOT_SUPPORTED_ERR then
301 ecx_debug.setErrorInfo(1,20,SQLERRM);
302 if(l_unexpectedEnabled) then
303 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
304 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
305 end if;
306 if (l_procedureEnabled) then
307 ecx_debug.pop(i_method_name);
308 end if;
309 raise ecx_utils.program_exit;
310 when xmlDOM.INUSE_ATTRIBUTE_ERR then
311 ecx_debug.setErrorInfo(1,20,SQLERRM);
312 if(l_unexpectedEnabled) then
313 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
314 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
315 end if;
316 if (l_procedureEnabled) then
317 ecx_debug.pop(i_method_name);
318 end if;
319 raise ecx_utils.program_exit;
320 when others then
321 ecx_debug.setErrorInfo(1,20,SQLERRM||' - ECX_INBOUND_TRIG.PARSEPAYLOAD ');
322 if(l_unexpectedEnabled) then
323 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
324 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
325 end if;
326 if (l_procedureEnabled) then
327 ecx_debug.pop(i_method_name);
328 end if;
329 raise ecx_utils.program_exit;
330 end parsepayload;
331
332
333 /**
334 Writes the XML from the CLOB to the file system
335 **/
336 procedure writeXMLToFile
337 (
338 i_xmldoc IN OUT NOCOPY CLOB
339 )
340 is
341 i_method_name varchar2(2000) := 'ecx_inbound_trig.writexmltofile';
342 i_logdir varchar2(200);
343
344 attachment_id pls_integer;
345 ctemp varchar2(32767);
346 clength pls_integer;
347 offset pls_integer := 1;
348 g_varmaxlength pls_integer := 1999;
349 g_instlmode VARCHAR2(100);
350
351 begin
352 g_instlmode := wf_core.translate('WF_INSTALL');
353 if (l_procedureEnabled) then
354 ecx_debug.push(i_method_name);
355 end if;
356 dbms_lob.createtemporary(i_xmldoc, TRUE,DBMS_LOB.SESSION);
357 dbms_lob.trim(i_xmldoc, 0);
358 xmlDOM.writetoCLOB(ecx_utils.g_xmldoc,i_xmldoc);
359
360 -- write XML to FS if debug > 0
361 if (l_statementEnabled)
362 then
363 IF g_instlmode = 'EMBEDDED' THEN
364 fnd_message.set_name('ecx', 'XML File for logging');
365 attachment_id := fnd_log.message_with_attachment(fnd_log.level_statement, substr(ecx_debug.g_aflog_module_name,1,length(ecx_debug.g_aflog_module_name)-4)||'.xml', TRUE);
366 if(attachment_id <> -1 AND i_xmldoc is not null) then
367 clength := dbms_lob.getlength(i_xmldoc);
368 while clength >= offset LOOP
369 ctemp := dbms_lob.substr(i_xmldoc,g_varmaxlength,offset);
370 fnd_log_attachment.writeln(attachment_id, ctemp);
371 offset := offset + g_varmaxlength;
372 End Loop;
373 fnd_log_attachment.close(attachment_id);
374 end if;
375 ELSE
376 xmlDOM.writetofile(ecx_utils.g_xmldoc,
377 ecx_utils.g_logdir||ecx_utils.getFileSeparator()||
378 substr(ecx_utils.g_logfile, 1,
379 length(ecx_utils.g_logfile)-4) ||'.xml');
380 END IF;
381 end if;
382
383
384 if (l_procedureEnabled) then
385 ecx_debug.pop(i_method_name);
386 end if;
387 end writeXMLToFile;
388
389
390 procedure processXMLData
391 (
392 i_map_id IN pls_integer,
393 i_payload IN clob,
394 i_header_id IN pls_integer,
395 i_rcv_tp_id IN pls_integer,
396 i_message_standard IN varchar2,
397 i_xmldoc OUT NOCOPY CLOB,
398 i_message_type IN varchar2
399 )
400 is
401
402 i_method_name varchar2(2000) := 'ecx_inbound_trig.processxmldata';
403 i_doc xmlDOM.DOMDocument;
404 l_same_map Boolean;
405 l_parseXML boolean;
406
407 begin
408 if (l_procedureEnabled) then
409 ecx_debug.push(i_method_name);
410 end if;
411 if(l_statementEnabled) then
412 ecx_debug.log(l_statement,'ecx_utils.g_map_id',ecx_utils.g_map_id,i_method_name);
413 ecx_debug.log(l_statement,'i_map_id',i_map_id,i_method_name);
414 ecx_debug.log(l_statement,'i_header_id',i_header_id,i_method_name);
415 ecx_debug.log(l_statement,'i_rcv_tp_id',i_rcv_tp_id,i_method_name);
416 ecx_debug.log(l_statement,'i_message_standard',i_message_standard,i_method_name);
417 end if;
418 -- Set the Transaction direction
419 ecx_utils.g_rec_tp_id := i_rcv_tp_id;
420 ecx_utils.g_direction := 'IN';
421 ecx_utils.initialize (i_map_id,l_same_map);
422 ecx_utils.g_source := ecx_utils.g_empty_source;
423 ecx_utils.g_target := ecx_utils.g_empty_target;
424
425 if (not ecx_utils.dom_printing) then
426 ecx_inbound_new.process_xml_doc (i_payload, i_map_id, i_xmldoc, l_parseXML);
427 else
428 /** Parse the Payload and handle any errors **/
429 begin
430 parsepayload(i_payload);
431 exception
432 when others then
433 raise ecx_utils.program_exit;
434 end;
435
436 i_doc := xmlparser.getDocument(ecx_utils.g_parser);
437
438 /** Assign it to the Global XML Document **/
439 ecx_utils.g_xmldoc := xmlDOM.makeNode(i_doc);
440
441 /** Get all the attributes in a generic way for a given standard and save in ecx_doclogs**/
442 getAttributes (
443 i_message_standard,
444 i_doc,
445 i_message_type
446 );
447
448 ecx_inbound.process_xml_doc (i_doc,i_map_id, i_header_id, i_rcv_tp_id,
449 i_xmldoc, l_parseXML);
450 end if;
451
452 xmlparser.freeparser(ecx_utils.g_parser);
453 if(ecx_utils.dom_printing = false and ecx_utils.structure_printing = true) -- xmltoxml different dtds.
454 then
455 xmlparser.freeparser(ecx_utils.g_inb_parser);
456 end if;
457
458 if (ecx_utils.dom_printing or (ecx_utils.structure_printing and l_parseXML)) then
459 if(l_statementEnabled) then
460 ecx_debug.log(l_statement,'XML is validated by the parser.',i_method_name);
461 end if;
462 writeXMLToFile(i_xmldoc);
463
464 begin
465 if not xmlDOM.isNull(ecx_utils.g_xmldoc) then
466 xmlDOM.freeDocument(xmlDOM.makeDocument(ecx_utils.g_xmldoc));
467 end if;
468 exception
469 when others then
470 null;
471 end;
472 else
473 if(l_statementEnabled) then
474 ecx_debug.log(l_statement,'XML is not validated by the parser.',i_method_name);
475 end if;
476 end if;
477 --for bug 5609625
478 xmlparser.freeparser(ecx_utils.g_parser);
479 if(ecx_utils.dom_printing = false and ecx_utils.structure_printing = true) -- xmltoxml different dtds.
480 then
481 xmlparser.freeparser(ecx_utils.g_inb_parser);
482 end if;
483 ---end of 5609625
484
485 if (l_procedureEnabled) then
486 ecx_debug.pop(i_method_name);
487 end if;
488
489 exception
490 when ecx_utils.program_exit then
491 if (l_procedureEnabled) then
492 ecx_debug.pop(i_method_name);
493 end if;
494 if(l_unexpectedEnabled) then
495 ecx_debug.log(l_unexpected,'Clean-up last_printed',i_method_name);
496 end if;
497 ecx_print_local.last_printed := -1;
498
499 begin
500 if not xmlDOM.isNull(ecx_utils.g_xmldoc) then
501 xmlDOM.freeDocument(xmlDOM.makeDocument(ecx_utils.g_xmldoc));
502 end if;
503 exception
504 when others then
505 null;
506 end;
507 raise ecx_utils.program_exit;
508
509 when others then
510 ecx_debug.setErrorInfo(1,20,SQLERRM||' - ECX_INBOUND_TRIG.processXMLData ');
511 if(l_unexpectedEnabled) then
512 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
513 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
514 ecx_debug.log(l_unexpected,'Clean-up last_printed',i_method_name);
515 end if;
516 ecx_print_local.last_printed := -1;
517 if (l_procedureEnabled) then
518 ecx_debug.pop(i_method_name);
519 end if;
520
521 begin
522 if not xmlDOM.isNull(ecx_utils.g_xmldoc) then
523 xmlDOM.freeDocument(xmlDOM.makeDocument(ecx_utils.g_xmldoc));
524 end if;
525 exception
526 when others then
527 null;
528 end;
529 raise ecx_utils.program_exit;
530 end processXMLData;
531
532 procedure validate_message
533 (
534 m_msgid IN raw,
535 m_message_standard IN varchar2,
536 m_ext_type in varchar2,
537 m_ext_subtype in varchar2,
538 m_party_ext_code IN varchar2,
539 m_document_number IN varchar2,
540 m_routing_ext_code IN varchar2,
541 m_payload IN clob,
542 m_message_type IN varchar2
543 )
544 is
545 i_method_name varchar2(2000) := 'ecx_inbound_trig.validate_message';
546 i_map_id pls_integer;
547 o_ret_code pls_integer;
548 o_ret_msg varchar2(2000);
549 i_dtd_id pls_integer;
550 i_rcv_tp_id pls_integer;
551 o_payload CLOB default null;
552 l_same_map Boolean;
553 i_routing_id pls_integer;
554 i_rcv_detail_id pls_integer;
555 i_header_id pls_integer;
556 i_int_transaction_type varchar2(200);
557 i_int_transaction_subtype varchar2(200);
558 i_out_msgid raw(16);
559 i_confirmation pls_integer;
560 -- i_node_type pls_integer;
561 i_map_type pls_integer := 0;
562
563 /** trading partner variables **/
564 p_party_id number;
565 p_party_site_id number;
566 p_org_id pls_integer;
567 p_admin_email varchar2(256);
568 retcode pls_integer;
569 retmsg varchar2(2000);
570
571 cursor c_tp_details
572 (
573 p_ext_type IN varchar2,
574 p_ext_subtype IN varchar2,
575 p_party_ext_code in varchar2,
576 p_message_standard in varchar2,
577 p_message_type in varchar2
578 )
579 is
580 select etd.map_id map_id,
581 etd.routing_id routing_id,
582 etd.tp_header_id tp_header_id,
583 etd.confirmation confirmation
584 from ecx_tp_details etd,
585 ecx_ext_processes eep,
586 ecx_standards es
587 where etd.source_tp_location_code = p_party_ext_code
588 and eep.ext_type = p_ext_type
589 and eep.ext_subtype = p_ext_subtype
590 and eep.ext_process_id = etd.ext_process_id
591 and eep.standard_id = es.standard_id
592 and es.standard_code = p_message_standard
593 and es.standard_type = nvl(p_message_type, 'XML')
594 and eep.direction = 'IN';
595
596 cursor get_routing_for_extcode
597 (
598 p_ext_type IN varchar2,
599 p_ext_subtype IN varchar2,
600 p_party_ext_code in varchar2,
601 p_message_standard in varchar2,
602 p_message_type in varchar2
603 )
604 is
605 select etd.tp_header_id tp_header_id,
606 etd.tp_detail_id tp_detail_id
607 from ecx_tp_details etd,
608 ecx_ext_processes eep,
609 ecx_standards es
610 where etd.source_tp_location_code = p_party_ext_code
611 and eep.ext_type = p_ext_type
612 and eep.ext_subtype = p_ext_subtype
613 and eep.ext_process_id = etd.ext_process_id
614 and eep.standard_id = es.standard_id
615 and es.standard_code = p_message_standard
616 and es.standard_type = nvl(p_message_type, 'XML')
617 and eep.direction = 'OUT';
618
619 cursor get_receiver_tp_id
620 (
621 p_routing_id IN pls_integer
622 ) is
623 select tp_header_id
624 from ecx_tp_details
625 where tp_detail_id = p_routing_id;
626
627 begin
628 if (l_procedureEnabled) then
629 ecx_debug.push(i_method_name);
630 end if;
631 if(l_statementEnabled) then
632 ecx_debug.log(l_statement,'m_message_standard',m_message_standard,i_method_name);
633 ecx_debug.log(l_statement,'m_ext_type',m_ext_type,i_method_name);
634 ecx_debug.log(l_statement,'m_ext_subtype',m_ext_subtype,i_method_name);
635 ecx_debug.log(l_statement,'m_party_ext_code',m_party_ext_code,i_method_name);
636 ecx_debug.log(l_statement,'m_document_number',m_document_number,i_method_name);
637 ecx_debug.log(l_statement,'m_routing_ext_code',m_routing_ext_code,i_method_name);
638 end if;
639 ecx_utils.i_ret_code :=0;
640 ecx_utils.i_errbuf :=null;
641 --MLS
642 ecx_utils.i_errparams := null;
643 ecx_utils.g_ret_code := 0;
644
645 --Check whether the Document has been enabled in the Exchange Server.
646 --If yes get the Map Id.
647 open c_tp_details ( m_ext_type, m_ext_subtype,m_party_ext_code,m_message_standard, m_message_type);
648 fetch c_tp_details
649 into i_map_id,
650 i_routing_id,
651 i_header_id,
652 i_confirmation;
653
654 if c_tp_details%NOTFOUND
655 then
656 ecx_debug.setErrorInfo(1,30,'ECX_TRANACTION_NOT_ENABLED',
657 'p_ext_type',
658 m_ext_type,
659 'p_ext_subtype',
660 m_ext_subtype,
661 'p_party_ext_code',
662 m_party_ext_code);
663
664 if(l_statementEnabled) then
665 ecx_debug.log(l_statement,'ECX','ECX_TRANACTION_NOT_ENABLED',
666 i_method_name,
667 'p_ext_type',
668 m_ext_type,
669 'p_ext_subtype',
670 m_ext_subtype,
671 'p_party_ext_code',
672 m_party_ext_code);
673 end if;
674
675 close c_tp_details;
676 raise ecx_utils.program_exit;
677 end if;
678
679 close c_tp_details;
680 -- Set the Sender's tp_id
681 ecx_utils.g_snd_tp_id := i_header_id;
682 if(l_statementEnabled) then
683 ecx_debug.log(l_statement,'i_map_id',i_map_id,i_method_name);
684 ecx_debug.log(l_statement,'i_routing_id',i_routing_id,i_method_name);
685 ecx_debug.log(l_statement,'i_header_id',i_header_id,i_method_name);
686 ecx_debug.log(l_statement,'i_confirmation',i_confirmation,i_method_name);
687 end if;
688
689 if (i_routing_id is not null or m_routing_ext_code is not null) then if not (is_routing_supported(i_map_id)) then
690 ecx_debug.setErrorInfo(2, 25, 'ECX_ROUTING_NOT_SUPPORTED');
691 raise ecx_utils.program_exit;
692 end if;
693 end if;
694
695 --Call the Send and Receive TP Id api's over here
696 --Pass through transaction Type , Document Number , Sender's Tp Id.
697 --i_transaction_type,i_document_number,i_snd_tp_id
698
699 --- Check whether routing enabled or not, if yes , is it static otherwise dynamic
700 if i_routing_id is not null
701 then
702 if m_routing_ext_code is not null
703 then
704 if(l_statementEnabled) then
705 ecx_debug.log(l_statement,'Dynamic Routing1',m_routing_ext_code,i_method_name);
706 end if;
707 open get_routing_for_extcode ( m_ext_type,m_ext_subtype,m_routing_ext_code,m_message_standard, m_message_type);
708 fetch get_routing_for_extcode
709 into i_rcv_tp_id,i_routing_id;
710
711 if get_routing_for_extcode%NOTFOUND
712 then
713 ecx_debug.setErrorInfo(1,30,
714 'ECX_DYN_ROUTING_NOT_ENABLED',
715 'p_ext_type',
716 m_ext_type,
717 'p_ext_subtype',
718 m_ext_subtype,
719 'p_party_ext_code',
720 m_party_ext_code);
721
722 if(l_statementEnabled) then
723 ecx_debug.log(l_statement,'ECX',
724 'ECX_DYN_ROUTING_NOT_ENABLED',
725 i_method_name,
726 'p_ext_type',
727 m_ext_type,
728 'p_ext_subtype',
729 m_ext_subtype,
730 'p_party_ext_code',
731 m_party_ext_code);
732 end if;
733
734 close get_routing_for_extcode;
735 raise ecx_utils.program_exit;
736 end if;
737
738 close get_routing_for_extcode;
739
740 else
741 open get_receiver_tp_id (i_routing_id);
742 fetch get_receiver_tp_id into i_rcv_tp_id;
743
744 if get_receiver_tp_id%NOTFOUND
745 then
746 ecx_debug.setErrorInfo(1,30,
747 'ECX_STATIC_ROUTING_NOT_ENABLED',
748 'p_ext_type',
749 m_ext_type,
750 'p_ext_subtype',
751 m_ext_subtype,
752 'p_party_ext_code',
753 m_party_ext_code);
754
755 if(l_statementEnabled) then
756 ecx_debug.log(l_statement,'ECX',
757 'ECX_STATIC_ROUTING_NOT_ENABLED',
758 i_method_name,
759 'p_ext_type',
760 m_ext_type,
761 'p_ext_subtype',
762 m_ext_subtype,
763 'p_party_ext_code',
764 m_party_ext_code);
765 end if;
766
767
768 close get_receiver_tp_id;
769 raise ecx_utils.program_exit;
770 end if;
771 close get_receiver_tp_id;
772 if(l_statementEnabled) then
773 ecx_debug.log(l_statement,'Static Routing',i_method_name);
774 end if;
775
776 end if;
777 ecx_utils.g_rec_tp_id := i_rcv_tp_id;
778 if(l_statementEnabled) then
779 ecx_debug.log(l_statement,'Receiver Tp Id ',i_rcv_tp_id,i_method_name);
780 end if;
781
782 else
783 --- Check for m_routing_ext_code if not null then use it
784
785 if m_routing_ext_code is not null
786 then
787 if(l_statementEnabled) then
788 ecx_debug.log(l_statement,'Dynamic Routing2',m_routing_ext_code,i_method_name);
789 end if;
790 open get_routing_for_extcode ( m_ext_type,m_ext_subtype,m_routing_ext_code,m_message_standard, m_message_type);
791 fetch get_routing_for_extcode
792 into i_rcv_tp_id,i_routing_id;
793
794 if get_routing_for_extcode%NOTFOUND
795 then
796 ecx_debug.setErrorInfo(1,30,
797 'ECX_DYN_ROUTING_NOT_ENABLED',
798 'p_ext_type',
799 m_ext_type,
800 'p_ext_subtype',
801 m_ext_subtype,
802 'p_party_ext_code',
803 m_party_ext_code);
804
805 if(l_statementEnabled) then
806 ecx_debug.log(l_statement,'ECX',
807 'ECX_DYN_ROUTING_NOT_ENABLED',
808 i_method_name,
809 'p_ext_type',
810 m_ext_type,
811 'p_ext_subtype',
812 m_ext_subtype,
813 'p_party_ext_code',
814 m_party_ext_code);
815 end if;
816
817 close get_routing_for_extcode;
818 raise ecx_utils.program_exit;
819 end if;
820 close get_routing_for_extcode;
821 else
822 -- if neither static nor dynamic routing is specified.
823 select count(1) into i_map_type
824 from ecx_objects
825 where object_type <> 'DB' and map_id = i_map_id;
826
827 if (i_map_type = 2) then
828 -- Only if map is xml to xml or dtd to dtd type
829 -- Give warning message.
830 ecx_utils.g_ret_code := 1;
831 if(l_statementEnabled) then
832 ecx_debug.log(l_statement,'ecx_utils.g_ret_code',' 1',i_method_name);
833 end if;
834 end if;
835 end if;
836 end if;
837
838 -- need to set the g_routing_id here, so that it would set it
839 -- for both dynamic and static routing.
840 ecx_utils.g_routing_id := i_routing_id;
841 if(l_statementEnabled) then
842 ecx_debug.log(l_statement,'ecx_utils.g_routing_id',ecx_utils.g_routing_id,
843 i_method_name);
844 end if;
845
846 /**
847 Since we have the sender tp_id , we can call the senders_tp_info and populate the org_id
848 **/
849 if ( ecx_utils.g_snd_tp_id is not null )
850 then
851 null;
852 ecx_trading_partner_pvt.get_tp_info
853 (
854 ecx_utils.g_snd_tp_id,
855 p_party_id,
856 p_party_site_id,
857 ecx_utils.g_org_id,
858 p_admin_email,
859 retcode,
860 retmsg
861 );
862 end if;
863
864
865 if(l_statementEnabled) then
866 ecx_debug.log(l_statement,'ECX','ECX_START_INBOUND',i_method_name, 'TRANSACTION_TYPE', m_ext_type);
867 end if;
868 processXMLData
869 (
870 i_map_id,
871 m_payload,
872 i_header_id,
873 i_rcv_tp_id,
874 m_message_standard,
875 o_payload,
876 m_message_type
877 );
878 if(l_statementEnabled) then
879 ecx_debug.log(l_statement, 'ECX', 'ECX_END_INBOUND',i_method_name, 'TRANSACTION_TYPE', m_ext_type);
880 end if;
881
882 savepoint save_xml_doc;
883
884 --If it is a pass through transaction , then put the Message on the Outbound Queue
885 if i_routing_id is not null
886 then
887 if(l_statementEnabled) then
888 ecx_debug.log(l_statement,'Routing Enqueued for MSGID : '|| m_msgid,i_method_name);
889 end if;
890 put_on_outbound
891 (
892 o_payload,
893 m_document_number,
894 i_routing_id,
895 m_msgid
896 );
897
898 else
899 if(l_statementEnabled) then
900 ecx_debug.log(l_statement,'Update doclogs for Msg Id : ' , m_msgid,i_method_name);
901 end if;
902 ecx_errorlog.update_log_document
903 (
904 m_msgid,
905 null,
906 'Inbound processing complete.',
907 ecx_utils.g_logfile,
908 null
909 );
910 end if;
911
912 if o_payload is not null
913 then
914 dbms_lob.freetemporary (o_payload);
915 end if;
916 if (l_procedureEnabled) then
917 ecx_debug.pop(i_method_name);
918 end if;
919 exception
920 when ecx_utils.program_exit then
921 --ecx_utils.g_map_id := -1;
922 if (l_procedureEnabled) then
923 ecx_debug.pop(i_method_name);
924 end if;
925
926 if o_payload is not null
927 then
928 dbms_lob.freetemporary (o_payload);
929 end if;
930 raise ecx_utils.program_exit;
931 when others then
932 --ecx_utils.g_map_id := -1;
933 ecx_debug.setErrorInfo(2,30,SQLERRM||' - ECX_INBOUND_TRIG.VALIDATE_MESSAGE ');
934 if(l_unexpectedEnabled) then
935 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
936 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
937 end if;
938
939 if o_payload is not null
940 then
941 dbms_lob.freetemporary (o_payload);
942 end if;
943 if (l_procedureEnabled) then
944 ecx_debug.pop(i_method_name);
945 end if;
946 raise ecx_utils.program_exit;
947 end validate_message;
948
949
950 procedure getmsg_from_queue
951 (
952 i_queue_name IN varchar2,
953 i_msgid OUT NOCOPY RAW
954 )
955 is
956 i_method_name varchar2(2000) := 'ecx_inbound_trig.getmsg_from_queue';
957 v_message system.ecxmsg;
958 v_dequeueoptions dbms_aq.dequeue_options_t;
959 v_messageproperties dbms_aq.message_properties_t;
960 c_nummessages CONSTANT INTEGER :=1;
961 e_qtimeout exception;
962 pragma exception_init(e_qtimeout,-25228);
963 l_retcode pls_integer := 0;
964 l_retmsg Varchar2(200) := null;
965
966 begin
967 if (l_procedureEnabled) then
968 ecx_debug.push(i_method_name);
969 end if;
970
971 if(l_statementEnabled) then
972 ecx_debug.log(l_statement,'i_queue_name',i_queue_name,i_method_name);
973 end if;
974
975 v_dequeueoptions.navigation := dbms_aq.FIRST_MESSAGE;
976 v_dequeueoptions.dequeue_mode := dbms_aq.BROWSE;
977 for i in 1..c_nummessages
978 loop
979 v_dequeueoptions.wait:=dbms_aq.NO_WAIT;
980
981 dbms_aq.dequeue
982 (
983 queue_name=>i_queue_name,
984 dequeue_options=>v_dequeueoptions,
985 message_properties=>v_messageproperties,
986 payload=>v_message,
987 msgid=> i_msgid
988 );
989
990 --Retrieve the Message Attributes
991
992 if(l_statementEnabled) then
993 ecx_debug.log(l_statement,'Message Standard',v_message.message_standard,i_method_name);
994 ecx_debug.log(l_statement,'Message Type',v_message.message_type,i_method_name);
995 ecx_debug.log(l_statement,'Transaction Type',v_message.transaction_type,i_method_name);
996 ecx_debug.log(l_statement,'Transaction Sub Type',v_message.transaction_subtype,i_method_name);
997 ecx_debug.log(l_statement,'Party Id',v_message.partyid,i_method_name);
998 ecx_debug.log(l_statement,'party Site Id',v_message.party_site_id,i_method_name);
999 ecx_debug.log(l_statement,'party type',v_message.party_type,i_method_name);
1000 ecx_debug.log(l_statement,'protocol_type ',v_message.protocol_type,i_method_name);
1001 ecx_debug.log(l_statement,'Protocol Address ',v_message.protocol_address,i_method_name);
1002 ecx_debug.log(l_statement,'Username ',v_message.username,i_method_name);
1003 ecx_debug.log(l_statement,'Password ',v_message.password,i_method_name);
1004 end if;
1005 begin
1006 ecx_errorlog.log_document (
1007 l_retcode,
1008 l_retmsg,
1009 i_msgid,
1010 v_message.message_type,
1011 v_message.message_standard,
1012 v_message.transaction_type,
1013 v_message.transaction_subtype,
1014 v_message.document_number,
1015 v_message.partyid,
1016 v_message.party_site_id,
1017 v_message.party_type,
1018 v_message.protocol_type,
1019 v_message.protocol_address,
1020 v_message.username,
1021 v_message.password,
1022 v_message.attribute1,
1023 v_message.attribute2,
1024 v_message.attribute3,
1025 v_message.attribute4,
1026 v_message.attribute5,
1027 v_message.payload,
1028 null
1029 );
1030
1031 if (l_retcode = 1) then
1032 if(l_unexpectedEnabled) then
1033 ecx_debug.log(l_unexpected, l_retmsg,i_method_name);
1034 end if;
1035 elsif (l_retcode >= 2 ) then
1036 if(l_unexpectedEnabled) then
1037 ecx_debug.log(l_unexpected,l_retmsg,i_method_name);
1038 end if;
1039 raise ecx_utils.program_exit;
1040 end if;
1041 end;
1042 if(l_statementEnabled) then
1043 ecx_debug.log(l_statement,'MessageId', i_msgid,i_method_name);
1044 end if;
1045
1046 end loop;
1047 if(l_statementEnabled) then
1048 ecx_debug.log(l_statement,'i_msgid',i_msgid,i_method_name);
1049 end if;
1050 if (l_procedureEnabled) then
1051 ecx_debug.pop(i_method_name);
1052 end if;
1053 exception
1054 when ecx_utils.program_exit then
1055 raise;
1056 when others then
1057 ecx_debug.setErrorInfo(2,30,SQLERRM||' - ECX_INBOUND_TRIG.GETMSG_FROM_QUEUE');
1058 if(l_unexpectedEnabled) then
1059 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
1060 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
1061 end if;
1062 raise ecx_utils.program_exit;
1063 end getmsg_from_queue;
1064
1065
1066 procedure put_on_outbound
1067 (
1068 i_xmldoc IN OUT NOCOPY CLOB,
1069 i_document_number IN varchar2,
1070 i_tp_detail_id IN pls_integer,
1071 i_msgid IN raw
1072 )
1073 is
1074
1075
1076 i_method_name varchar2(2000) := 'ecx_inbound_trig.put_on_outbound';
1077 e_qtimeout exception;
1078
1079 i_out_msgid raw(16);
1080 i_standard_type varchar2(20);
1081 i_standard_code varchar2(20);
1082 i_ext_type varchar2(200);
1083 i_ext_subtype varchar2(200);
1084 i_source_code varchar2(200);
1085 i_destination_code varchar2(200);
1086 i_destination_type varchar2(200);
1087 i_destination_address ecx_tp_details.protocol_address%TYPE;
1088 i_username varchar2(200);
1089 i_password varchar2(500);
1090 i_hub_user_id number DEFAULT 0;
1091 pragma exception_init(e_qtimeout,-25228);
1092 i_event wf_event_t;
1093 i_from_agt wf_agent_t := wf_agent_t(NULL, NULL);
1094 i_system varchar2(200);
1095 i_int_type varchar2(200);
1096 i_int_subtype varchar2(200);
1097 i_party_id number;
1098 i_party_site_id number;
1099 i_party_type varchar2(200);
1100
1101 begin
1102
1103 if (l_procedureEnabled) then
1104 ecx_debug.push(i_method_name);
1105 end if;
1106 if(l_statementEnabled) then
1107 ecx_debug.log(l_statement,'i_document_number',i_document_number,i_method_name);
1108 ecx_debug.log(l_statement,'i_tp_detail_id',i_tp_detail_id,i_method_name);
1109 end if;
1110
1111 begin
1112 select es.standard_type standard_type,
1113 es.standard_code standard_code,
1114 source_tp_location_code source,
1115 external_tp_location_code destination,
1116 protocol_type,
1117 protocol_address,
1118 username,
1119 password,
1120 hub_user_id,
1121 eep.ext_type ext_type,
1122 eep.ext_subtype ext_subtype,
1123 et.transaction_type,
1124 et.transaction_subtype,
1125 eth.party_id,
1126 eth.party_site_id,
1127 eth.party_type
1128 into i_standard_type,
1129 i_standard_code,
1130 i_source_code,
1131 i_destination_code,
1132 i_destination_type,
1133 i_destination_address,
1134 i_username,
1135 i_password,
1136 i_hub_user_id,
1137 i_ext_type,
1138 i_ext_subtype,
1139 i_int_type,
1140 i_int_subtype,
1141 i_party_id,
1142 i_party_site_id,
1143 i_party_type
1144 from ecx_tp_details etd,
1145 ecx_ext_processes eep,
1146 ecx_standards es,
1147 ecx_transactions et,
1148 ecx_tp_headers eth
1149 where etd.tp_detail_id = i_tp_detail_id
1150 and es.standard_id = eep.standard_id
1151 and eep.ext_process_id = etd.ext_process_id
1152 and eep.transaction_id = et.transaction_id
1153 and eep.direction = 'OUT'
1154 and etd.tp_header_id = eth.tp_header_id;
1155 exception
1156 when others then
1157 ecx_debug.setErrorInfo(1,25,'ECX_NO_UNIQUE_TP_SETUP');
1158 raise ecx_utils.program_exit;
1159 end;
1160
1161 if i_hub_user_id is not null
1162 then
1163 begin
1164 select hub_entity_code,
1165 protocol_type,
1166 protocol_address,
1167 username,
1168 password
1169 into i_source_code,
1170 i_destination_type,
1171 i_destination_address,
1172 i_username,
1173 i_password
1174 from ecx_hubs eh,
1175 ecx_hub_users ehu
1176 where eh.hub_id = ehu.hub_id
1177 and ehu.hub_user_id = i_hub_user_id;
1178 exception
1179 when others then
1180 ecx_debug.setErrorInfo(1,25,'ECX_DELIVERY_HUB_NOT_SETUP');
1181 raise ecx_utils.program_exit;
1182 end;
1183 end if;
1184
1185 if i_destination_address is null
1186 then
1187 ecx_debug.setErrorInfo(1,25,'ECX_PROTOCOL_ADDR_NULL',
1188 'p_tp_location_code', i_source_code,
1189 'p_transaction_type', i_ext_type,
1190 'p_transaction_subtype', i_ext_subtype,
1191 'p_standard', i_standard_code);
1192
1193 raise ecx_utils.program_exit;
1194 end if;
1195 if (l_statementEnabled) then
1196 ecx_debug.log(l_statement,'i_standard_type',i_standard_type,i_method_name);
1197 ecx_debug.log(l_statement,'i_standard_code',i_standard_code,i_method_name);
1198 ecx_debug.log(l_statement,'i_ext_type',i_ext_type,i_method_name);
1199 ecx_debug.log(l_statement,'i_ext_subtype',i_ext_subtype,i_method_name);
1200 ecx_debug.log(l_statement,'i_int_type', i_int_type,i_method_name);
1201 ecx_debug.log(l_statement,'i_int_subtype', i_int_subtype,i_method_name);
1202 ecx_debug.log(l_statement,'i_source_code',i_source_code,i_method_name);
1203 ecx_debug.log(l_statement,'i_destination_code',i_destination_code,i_method_name);
1204 ecx_debug.log(l_statement,'i_destination_type',i_destination_type,i_method_name);
1205 ecx_debug.log(l_statement,'i_destination_address',i_destination_address,i_method_name);
1206 ecx_debug.log(l_statement,'i_username',i_username,i_method_name);
1207 ecx_debug.log(l_statement,'i_party_id',i_party_id,i_method_name);
1208 ecx_debug.log(l_statement,'i_party_site_id', i_party_site_id,i_method_name);
1209 ecx_debug.log(l_statement,'i_party_type', i_party_type,i_method_name);
1210 end if;
1211 -- call ecx_out_wf_qh.enqueue with the correct parameters
1212 wf_event_t.initialize(i_event);
1213 i_event.addParameterToList('PARTY_TYPE', i_party_type);
1214 i_event.addParameterToList('PARTYID', i_party_id);
1215 i_event.addParameterToList('PARTY_SITE_ID', i_source_code);
1216 -- added this for passthrough logging purposes in ecx_out_wf_qh
1217 i_event.addParameterToList('INT_PARTY_SITE_ID', i_party_site_id);
1218 i_event.addParameterToList('DOCUMENT_NUMBER', i_document_number);
1219 i_event.addParameterToList('MESSAGE_TYPE', i_standard_type);
1220 i_event.addParameterToList('MESSAGE_STANDARD', i_standard_code);
1221 i_event.addParameterToList('TRANSACTION_TYPE', i_ext_type);
1222 i_event.addParameterToList('TRANSACTION_SUBTYPE', i_ext_subtype);
1223 i_event.addParameterToList('INT_TRANSACTION_TYPE', i_int_type);
1224 i_event.addParameterToList('INT_TRANSACTION_SUBTYPE', i_int_subtype);
1225 i_event.addParameterToList('PROTOCOL_TYPE', i_destination_type);
1226 i_event.addParameterToList('PROTOCOL_ADDRESS', i_destination_address);
1227 i_event.addParameterToList('USERNAME', i_username);
1228 i_event.addParameterToList('PASSWORD', i_password);
1229 i_event.addParameterToList('ATTRIBUTE1', ecx_utils.g_company_name);
1230 i_event.addParameterToList('ATTRIBUTE2', null);
1231 i_event.addParameterToList('ATTRIBUTE3', i_destination_code);
1232 i_event.addParameterToList('ATTRIBUTE4', null);
1233 i_event.addParameterToList('ATTRIBUTE5', null);
1234 i_event.addParameterToList('DIRECTION', ecx_utils.g_direction);
1235 i_event.addParameterToList('LOGFILE', ecx_utils.g_logfile);
1236 i_event.addParameterToList('ECX_MSG_ID', i_msgid);
1237
1238 i_event.event_data := i_xmldoc;
1239
1240 -- set the from agent
1241 select name
1242 into i_system
1243 from wf_systems
1244 where guid = wf_core.translate('WF_SYSTEM_GUID');
1245
1246 i_from_agt.setname('ECX_OUTBOUND');
1247 i_from_agt.setsystem(i_system);
1248
1249 i_event.setFromAgent(i_from_agt);
1250
1251 if(l_statementEnabled) then
1252 ecx_debug.log(l_statement,'Calling WF_EVENT.Send for Enqueue',i_method_name);
1253 end if;
1254 wf_event.send(i_event);
1255 ecx_errorlog.outbound_log(i_event);
1256
1257 i_out_msgid := ecx_out_wf_qh.msgid;
1258
1259 -- check the retcode and retmsg. This should be populated here only
1260 -- in the case of dup val index when inserting in doclogs (since no
1261 -- exception is raised in this case)
1262 if (ecx_out_wf_qh.retmsg is not null) then
1263 --ecx_utils.error_type := 30;
1264 --ecx_utils.i_ret_code := ecx_out_wf_qh.retcode;
1265 --ecx_utils.i_errbuf := ecx_out_wf_qh.retmsg;
1266 ecx_debug.setErrorInfo(ecx_out_wf_qh.retcode,30,ecx_out_wf_qh.retmsg);
1267 if(l_statementEnabled) then
1268 ecx_debug.log(l_statement,ecx_debug.getMessage(ecx_utils.i_errbuf,
1269 ecx_utils.i_errparams),i_method_name); -- MLS
1270 end if;
1271 end if;
1272
1273 if(l_statementEnabled) then
1274 ecx_debug.log(l_statement,'Routed MsgId',i_out_msgid,i_method_name);
1275 end if;
1276 if (l_procedureEnabled) then
1277 ecx_debug.pop(i_method_name);
1278 end if;
1279 exception
1280 WHEN ECX_UTILS.PROGRAM_EXIT THEN
1281 --dbms_lob.freetemporary(i_xmldoc);
1282 if (l_procedureEnabled) then
1283 ecx_debug.pop(i_method_name);
1284 end if;
1285 raise ecx_utils.program_exit;
1286 when others then
1287 --dbms_lob.freetemporary(i_xmldoc);
1288 if (ecx_out_wf_qh.retmsg is null AND ecx_out_wf_qh.retcode = 0)
1289 then
1290 ecx_debug.setErrorInfo(2,30,SQLERRM || ' - ECX_INBOUND_TRIG.PUT_ON_OUTBOUND');
1291 else
1292 --ecx_utils.i_ret_code := ecx_out_wf_qh.retcode;
1293 --ecx_utils.i_errbuf := ecx_out_wf_qh.retmsg;
1294 ecx_debug.setErrorInfo(ecx_out_wf_qh.retcode,30,ecx_out_wf_qh.retmsg);
1295 end if;
1296 --ecx_utils.error_type := 30;
1297 if(l_unexpectedEnabled) then
1298 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,
1299 ecx_utils.i_errparams),i_method_name); -- MLS
1300 end if;
1301 raise ecx_utils.program_exit;
1302 end put_on_outbound;
1303
1304 /**
1305 Old put_on_outbound - pre BES integration
1306 Present for backward compatibility
1307 **/
1308
1309 procedure put_on_outbound
1310 (
1311 i_xmldoc IN OUT NOCOPY CLOB,
1312 i_document_number IN varchar2,
1313 i_tp_detail_id IN pls_integer
1314 )
1315 is
1316 i_method_name varchar2(2000) := 'ecx_inbound_trig.put_on_outbound';
1317 v_message system.ecxmsg;
1318 v_enqueueoptions dbms_aq.enqueue_options_t;
1319 v_messageproperties dbms_aq.message_properties_t;
1320 i_msgid raw(16);
1321 c_nummessages CONSTANT INTEGER :=1;
1322 e_qtimeout exception;
1323
1324 i_standard_type varchar2(20);
1325 i_standard_code varchar2(20);
1326 i_ext_type varchar2(200);
1327 i_ext_subtype varchar2(200);
1328 i_source_code varchar2(200);
1329 i_destination_code varchar2(200);
1330 i_destination_type varchar2(200);
1331 i_destination_address ecx_tp_details.protocol_address%TYPE;
1332 i_username varchar2(200);
1333 i_password varchar2(500);
1334 m_password varchar2(500);
1335 i_hub_user_id number;
1336 i_party_type varchar2(30) := null;
1337 o_retcode pls_integer;
1338 o_retmsg varchar2(2000);
1339 pragma exception_init(e_qtimeout,-25228);
1340 l_retcode pls_integer := 0;
1341 l_retmsg Varchar2(200) := null;
1342
1343 begin
1344 if (l_procedureEnabled) then
1345 ecx_debug.push(i_method_name);
1346 end if;
1347 if(l_statementEnabled) then
1348 ecx_debug.log(l_statement,'i_document_number',i_document_number,i_method_name);
1349 ecx_debug.log(l_statement,'i_tp_detail_id',i_tp_detail_id,i_method_name);
1350 end if;
1351
1352 begin
1353 select es.standard_type standard_type,
1354 es.standard_code standard_code,
1355 source_tp_location_code source,
1356 external_tp_location_code destination,
1357 protocol_type,
1358 protocol_address,
1359 username,
1360 password,
1361 hub_user_id,
1362 eep.ext_type ext_type,
1363 eep.ext_subtype ext_subtype
1364 into i_standard_type,
1365 i_standard_code,
1366 i_source_code,
1367 i_destination_code,
1368 i_destination_type,
1369 i_destination_address,
1370 i_username,
1371 i_password,
1372 i_hub_user_id,
1373 i_ext_type,
1374 i_ext_subtype
1375 from ecx_tp_details etd,
1376 ecx_ext_processes eep,
1377 ecx_standards es
1378 where etd.tp_detail_id = i_tp_detail_id
1379 and es.standard_id = eep.standard_id
1380 and eep.ext_process_id = etd.ext_process_id;
1381
1382 exception
1383 when others then
1384 ecx_debug.setErrorInfo(1,25,'ECX_NO_UNIQUE_TP_SETUP');
1385 raise ecx_utils.program_exit;
1386 end;
1387
1388 if i_hub_user_id is not null
1389 then
1390 begin
1391 select hub_entity_code,
1392 protocol_type,
1393 protocol_address,
1394 username,
1395 password
1396 into i_source_code,
1397 i_destination_type,
1398 i_destination_address,
1399 i_username,
1400 i_password
1401 from ecx_hubs eh,
1402 ecx_hub_users ehu
1403 where eh.hub_id = ehu.hub_id
1404 and ehu.hub_user_id = i_hub_user_id;
1405
1406 exception
1407 when others then
1408 ecx_debug.setErrorInfo(1,25,'ECX_DELIVERY_HUB_NOT_SETUP');
1409 if(l_unexpectedEnabled) then
1410 ecx_debug.log(l_unexpected,'ERROR', SQLERRM,i_method_name);
1411 end if;
1412 raise ecx_utils.program_exit;
1413 end;
1414 end if;
1415
1416
1417 if i_destination_address is null
1418 then
1419 ecx_debug.setErrorInfo(1,25,'ECX_PROTOCOL_ADDR_NULL',
1420 'p_tp_location_code', i_source_code,
1421 'p_transaction_type', i_ext_type,
1422 'p_transaction_subtype', i_ext_subtype,
1423 'p_standard', i_standard_code);
1424 raise ecx_utils.program_exit;
1425 end if;
1426
1427 ecx_obfuscate.ecx_data_encrypt
1428 (
1429 i_password,
1430 'D',
1431 m_password,
1432 o_retcode,
1433 o_retmsg
1434 );
1435
1436 if (o_retcode > 0)
1437 then
1438 --ecx_utils.i_ret_code := o_retcode;
1439 --ecx_utils.i_errbuf := o_retmsg;
1440 --ecx_utils.error_type := 30;
1441 ecx_debug.setErrorInfo(o_retcode,30,o_retmsg);
1442 raise ecx_utils.program_exit;
1443 end if;
1444 if(l_statementEnabled) then
1445 ecx_debug.log(l_statement,'i_standard_type',i_standard_type,i_method_name);
1446 ecx_debug.log(l_statement,'i_standard_code',i_standard_code,i_method_name);
1447 ecx_debug.log(l_statement,'i_ext_type',i_ext_type,i_method_name);
1448 ecx_debug.log(l_statement,'i_ext_subtype',i_ext_subtype,i_method_name);
1449 ecx_debug.log(l_statement,'i_source_code',i_source_code,i_method_name);
1450 ecx_debug.log(l_statement,'i_destination_code',i_destination_code,i_method_name);
1451 ecx_debug.log(l_statement,'i_destination_type',i_destination_type,i_method_name);
1452 ecx_debug.log(l_statement,'i_destination_address',i_destination_address,i_method_name);
1453 ecx_debug.log(l_statement,'i_username',i_username,i_method_name);
1454 end if;
1455 --ecx_debug.log(3,'i_password',i_password);
1456
1457 v_message:=system.ecxmsg
1458 (
1459 i_standard_type,
1460 i_standard_code,
1461 i_ext_type,
1462 i_ext_subtype,
1463 i_document_number,
1464 null,
1465 i_source_code,
1466 null,
1467 i_destination_type,
1468 i_destination_address,
1469 i_username,
1470 m_password,
1471 i_xmldoc,
1472 ecx_utils.g_company_name,
1473 null,
1474 i_destination_code,
1475 null,
1476 null
1477 );
1478
1479 begin
1480 select party_type
1481 into i_party_type
1482 from ecx_tp_headers eth,
1483 ecx_tp_details etd
1484 where eth.tp_header_id = etd.tp_header_id
1485 and etd.tp_detail_id = i_tp_detail_id;
1486 exception
1487 when others then
1488 ecx_debug.setErrorInfo(1,30, SQLERRM);
1489 raise ecx_utils.program_exit;
1490 end;
1491
1492 v_message.party_type := i_party_type;
1493
1494 v_messageproperties.correlation := 'OXTA';
1495 -- Enqueue
1496 dbms_aq.enqueue
1497 (
1498 queue_name=>'ECX_OUTBOUND',
1499 enqueue_options=>v_enqueueoptions,
1500 message_properties=>v_messageproperties,
1501 payload=>v_message,
1502 msgid=>i_msgid
1503 );
1504
1505 --Keep a log of the Outgoing Messages
1506 begin
1507 ecx_errorlog.log_document (
1508 l_retcode,
1509 l_retmsg,
1510 i_msgid,
1511 v_message.message_type,
1512 v_message.message_standard,
1513 v_message.transaction_type,
1514 v_message.transaction_subtype,
1515 v_message.document_number,
1516 v_message.partyid,
1517 v_message.party_site_id,
1518 v_message.party_type,
1519 v_message.protocol_type,
1520 v_message.protocol_address,
1521 v_message.username,
1522 v_message.password,
1523 v_message.attribute1,
1524 v_message.attribute2,
1525 v_message.attribute3,
1526 v_message.attribute4,
1527 v_message.attribute5,
1528 v_message.payload,
1529 null,
1530 null,
1531 'OUT'
1532 );
1533
1534 if (l_retcode = 1) then
1535 if(l_unexpectedEnabled) then
1536 ecx_debug.log(l_unexpected, l_retmsg,i_method_name);
1537 end if;
1538 elsif (l_retcode >= 2 ) then
1539 if(l_unexpectedEnabled) then
1540 ecx_debug.log(l_unexpected, l_retmsg,i_method_name);
1541 end if;
1542 raise ecx_utils.program_exit;
1543 end if;
1544 end;
1545
1546 -- maintain attachment mappings if this is a passthrough case
1547 ecx_attachment.remap_attachments(i_msgid);
1548
1549 if(l_statementEnabled) then
1550 ecx_debug.log(l_statement,'Routed MsgId',i_msgid,i_method_name);
1551 end if;
1552 if (l_procedureEnabled) then
1553 ecx_debug.pop(i_method_name);
1554 end if;
1555 exception
1556 WHEN ECX_UTILS.PROGRAM_EXIT THEN
1557 i_hub_user_id := null;
1558 if (l_procedureEnabled) then
1559 ecx_debug.pop(i_method_name);
1560 end if;
1561 raise ecx_utils.program_exit;
1562 when others then
1563 i_hub_user_id := null;
1564 ecx_debug.setErrorInfo(2,30, SQLERRM|| ' - ECX_INBOUND_TRIG.PUT_ON_OUTBOUND');
1565 if(l_unexpectedEnabled) then
1566 --ecx_debug.log(l_statement,ecx_utils.i_errbuf,i_method_name);
1567 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
1568 end if;
1569 raise ecx_utils.program_exit;
1570 end put_on_outbound;
1571
1572 --This is for Internal testing and Debugging Only. Takes the Message
1573 --off from the given Queue in the Browse Mode and processes it.
1574
1575 procedure processmsg_from_queue
1576 (
1577 i_queue_name IN varchar2,
1578 i_debug_level IN pls_integer
1579 )
1580 is
1581 i_method_name varchar2(2000) := 'ecx_inbound_trig.processmsg_from_queue';
1582 v_msgid raw(16);
1583 i_logdir varchar2(200);
1584 i_trigger_id pls_integer;
1585
1586 -- logging enabled
1587 ecx_logging_enabled boolean := false;
1588 logging_enabled varchar2(20);
1589 module varchar2(2000);
1590
1591 begin
1592 fnd_profile.get('AFLOG_ENABLED',logging_enabled);
1593 fnd_profile.get('AFLOG_MODULE',module);
1594 if ecx_debug.g_v_module_name is null then
1595 ecx_debug.module_enabled;
1596 end if;
1597
1598 if(logging_enabled = 'Y' AND ((lower(module) like 'ecx%'
1599 AND instr(lower(ecx_debug.g_v_module_name),rtrim(lower(module),'%'))> 0)
1600 OR module='%')
1601 AND FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_UNEXPECTED) then
1602 ecx_logging_enabled := true;
1603 end if;
1604 -- /logging enabled
1605
1606 IF (ecx_logging_enabled ) THEN
1607 ecx_utils.getLogDirectory;
1608 ecx_debug.enable_debug_new(i_debug_level,ecx_utils.g_logdir, 'IN'||i_queue_name||'.log', 'in.'||i_queue_name||'.log');
1609 END IF;
1610
1611 /* Assign local variables with the ecx_debug global variables*/
1612 l_procedure := ecx_debug.g_procedure;
1613 l_statement := ecx_debug.g_statement;
1614 l_unexpected := ecx_debug.g_unexpected;
1615 l_procedureEnabled := ecx_debug.g_procedureEnabled;
1616 l_statementEnabled := ecx_debug.g_statementEnabled;
1617 l_unexpectedEnabled := ecx_debug.g_unexpectedEnabled;
1618
1619 if (l_procedureEnabled) then
1620 ecx_debug.push(i_method_name);
1621 end if;
1622
1623 if(l_statementEnabled) then
1624 ecx_debug.log(l_statement,'i_queue_name',i_queue_name,i_method_name);
1625 ecx_debug.log(l_statement,'i_debug_level',i_debug_level,i_method_name);
1626 end if;
1627
1628 getmsg_from_queue(i_queue_name,v_msgid);
1629
1630 --validate_message( v_msgid, i_debug_level,i_trigger_id);
1631
1632 if (l_procedureEnabled) then
1633 ecx_debug.pop(i_method_name);
1634 end if;
1635 IF (ecx_logging_enabled ) THEN
1636 ecx_debug.print_log;
1637 ecx_debug.disable_debug;
1638 END IF;
1639
1640 exception
1641 when ecx_utils.program_exit then
1642 if(l_unexpectedEnabled) then
1643 --ecx_debug.log(l_unexpected,ecx_utils.i_errbuf,i_method_name);
1644 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
1645 end if;
1646 IF (ecx_logging_enabled ) THEN
1647 ecx_debug.print_log;
1648 ecx_debug.disable_debug;
1649 END IF;
1650 when others then
1651 ecx_utils.i_errbuf := SQLERRM || ' - ECX_INBOUND_TRIG.PROCESSMSG_FROM_QUEUE';
1652 if(l_unexpectedEnabled) then
1653 --ecx_debug.log(l_unexpected,ecx_utils.i_errbuf,i_method_name);
1654 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
1655 end if;
1656 IF (ecx_logging_enabled ) THEN
1657 ecx_debug.print_log;
1658 ecx_debug.disable_debug;
1659 END IF;
1660 end processmsg_from_queue;
1661
1662
1663 procedure processmsg_from_table
1664 (
1665 i_msgid IN RAW,
1666 i_debug_level IN pls_integer
1667 )
1668 is
1669 i_method_name varchar2(2000) := 'ecx_inbound_trig.processmsg_from_table';
1670 i_logdir varchar2(200);
1671 i_trigger_id pls_integer;
1672
1673 -- logging enabled
1674 ecx_logging_enabled boolean := false;
1675 logging_enabled varchar2(20);
1676 module varchar2(2000);
1677
1678 begin
1679 fnd_profile.get('AFLOG_ENABLED',logging_enabled);
1680 fnd_profile.get('AFLOG_MODULE',module);
1681
1682 if(logging_enabled = 'Y' AND ((lower(module) like 'ecx%'
1683 AND instr(lower(ecx_debug.g_v_module_name),rtrim(lower(module),'%'))> 0)
1684 OR module='%')
1685 AND FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_UNEXPECTED) then
1686 ecx_logging_enabled := true;
1687 end if;
1688 -- /logging enabled
1689
1690 IF (ecx_logging_enabled ) THEN
1691 --get the Log directory from the Profile Option.
1692 ecx_utils.getLogDirectory;
1693 ecx_debug.enable_debug_new(i_debug_level, ecx_utils.g_logdir, 'IN' ||i_msgid||'.log', 'in.'||i_msgid||'.log');
1694 END IF;
1695
1696 /* Assign local variables with the ecx_debug global variables*/
1697 l_procedure := ecx_debug.g_procedure;
1698 l_statement := ecx_debug.g_statement;
1699 l_unexpected := ecx_debug.g_unexpected;
1700 l_procedureEnabled := ecx_debug.g_procedureEnabled;
1701 l_statementEnabled := ecx_debug.g_statementEnabled;
1702 l_unexpectedEnabled := ecx_debug.g_unexpectedEnabled;
1703
1704 if (l_procedureEnabled) then
1705 ecx_debug.push(i_method_name);
1706 end if;
1707
1708 if(l_statementEnabled) then
1709 ecx_debug.log(l_statement,'i_msgid',i_msgid,i_method_name);
1710 ecx_debug.log(l_statement,'i_debug_level',i_debug_level,i_method_name);
1711 end if;
1712
1713 --validate_message( i_msgid, i_debug_level,i_trigger_id);
1714
1715 if (l_procedureEnabled) then
1716 ecx_debug.pop(i_method_name);
1717 end if;
1718
1719 IF (ecx_logging_enabled ) THEN
1720 ecx_debug.print_log;
1721 ecx_debug.disable_debug;
1722 END IF;
1723
1724 exception
1725 when ecx_utils.program_exit then
1726 if(l_unexpectedEnabled) then
1727 --ecx_debug.log(l_unexpected,ecx_utils.i_errbuf,i_method_name);
1728 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
1729 end if;
1730 IF (ecx_logging_enabled ) THEN
1731 ecx_debug.print_log;
1732 ecx_debug.disable_debug;
1733 END IF;
1734
1735 when others then
1736 ecx_utils.i_errbuf := SQLERRM || ' - ECX_INBOUND_TRIG.PROCESSMSG_FROM_TABLE';
1737 if(l_unexpectedEnabled) then
1738 --ecx_debug.log(l_unexpected,ecx_utils.i_errbuf,i_method_name);
1739 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
1740 end if;
1741
1742 IF (ecx_logging_enabled ) THEN
1743 ecx_debug.print_log;
1744 ecx_debug.disable_debug;
1745 END IF;
1746 end processmsg_from_table;
1747
1748 /** New wrap validate message for use with BES
1749 Removed AUTONOMOUS_TRANSACTION, commit and rollback
1750 **/
1751 procedure wrap_validate_message
1752 (
1753 i_msgid IN RAW,
1754 i_debug_level IN pls_integer
1755 )
1756 is
1757 g_instlmode VARCHAR2(100);
1758 i_method_name varchar2(2000) := 'ecx_inbound_trig.wrap_validate_message';
1759 i_logdir varchar2(200);
1760 i_logfile varchar2(200);
1761 msg_not_found exception;
1762
1763 m_transaction_type varchar2(200);
1764 m_transaction_subtype varchar2(200);
1765 m_message_standard varchar2(200);
1766 m_message_type varchar2(200);
1767 m_document_number varchar2(200);
1768 m_routing_ext_code varchar2(200);
1769 m_party_ext_code varchar2(200);
1770 m_payload CLOB;
1771 m_internal_control_number pls_integer;
1772
1773 cursor get_run_s
1774 is
1775 select ecx_output_runs_s.NEXTVAL
1776 from dual;
1777
1778 cursor get_msg
1779 (
1780 p_msgid in raw
1781 )
1782 is
1783 select message_standard,
1784 message_type,
1785 transaction_type,
1786 transaction_subtype,
1787 party_site_id,
1788 payload,
1789 document_number,
1790 attribute3,
1791 internal_control_number
1792 from ecx_doclogs
1793 where msgid = p_msgid
1794 for update;
1795 p_aflog_module_name VARCHAR2(2000) ;
1796
1797 -- logging enabled
1798 ecx_logging_enabled boolean := false;
1799 logging_enabled varchar2(20);
1800 module varchar2(2000);
1801
1802 begin
1803
1804 open get_msg (i_msgid);
1805 fetch get_msg
1806 into m_message_standard,
1807 m_message_type,
1808 m_transaction_type,
1809 m_transaction_subtype,
1810 m_party_ext_code,
1811 m_payload,
1812 m_document_number,
1813 m_routing_ext_code,
1814 m_internal_control_number;
1815
1816 if get_msg%NOTFOUND
1817 then
1818 close get_msg;
1819 raise msg_not_found;
1820 end if;
1821
1822 close get_msg;
1823 ecx_utils.g_direction := 'IN';
1824 ecx_utils.g_logfile :=null;
1825 ecx_debug.g_v_module_name :='ecx.plsql.';
1826 ecx_utils.g_transaction_type := m_transaction_type;
1827 ecx_utils.g_transaction_subtype := m_transaction_subtype;
1828 ecx_utils.g_msgid := i_msgid;
1829 begin
1830 select standard_id
1831 into ecx_utils.g_standard_id
1832 from ecx_standards
1833 where standard_code = m_message_standard
1834 and standard_type = nvl(m_message_type, 'XML');
1835 if(l_statementEnabled) then
1836 ecx_debug.log(l_statement,'Standard id',ecx_utils.g_standard_id,i_method_name);
1837 end if;
1838 exception
1839 when others then
1840 ecx_debug.setErrorInfo(1,30,'ECX_UNSUPPORTED_STANDARD');
1841 raise ecx_utils.program_exit;
1842 end;
1843 ecx_debug.module_enabled;
1844 g_instlmode := wf_core.translate('WF_INSTALL');
1845
1846 if(g_instlmode = 'EMBEDDED')
1847 THEN
1848 fnd_profile.get('AFLOG_ENABLED',logging_enabled);
1849 fnd_profile.get('AFLOG_MODULE',module);
1850 if(logging_enabled = 'Y' AND ((lower(module) like 'ecx%'
1851 AND instr(lower(ecx_debug.g_v_module_name),rtrim(lower(module),'%'))> 0)
1852 OR module='%')
1853 AND FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_UNEXPECTED) then
1854 ecx_logging_enabled := true;
1855 end if;
1856 elsif(g_instlmode = 'STANDALONE')
1857 then
1858 if (i_debug_level > 0) then
1859 ecx_logging_enabled := true;
1860 end if;
1861 end if;
1862 IF (ecx_logging_enabled ) THEN
1863 /**
1864 Fetch the Run Id for the Transaction
1865 **/
1866 open get_run_s;
1867 fetch get_run_s
1868 into ecx_utils.g_run_id;
1869 close get_run_s;
1870
1871 --get the Log directory from the Profile Option.
1872 ecx_utils.getLogDirectory;
1873
1874 i_logfile := substr(m_message_standard,1,10)||'IN'||substr(m_transaction_type,1,20)||substr(m_transaction_subtype,1,20)||ecx_utils.g_run_id||'.log';
1875
1876 p_aflog_module_name := '';
1877 IF (m_message_standard is not null) THEN
1878 p_aflog_module_name := p_aflog_module_name||m_message_standard||'.';
1879 END IF;
1880 p_aflog_module_name := p_aflog_module_name || 'in.';
1881 IF (m_transaction_type is not null) THEN
1882 p_aflog_module_name := p_aflog_module_name||m_transaction_type||'.';
1883 END IF;
1884 IF (m_transaction_subtype is not null) THEN
1885 p_aflog_module_name := p_aflog_module_name||m_transaction_subtype||'.';
1886 END IF;
1887 IF (ecx_utils.g_run_id is not null) THEN
1888 p_aflog_module_name := p_aflog_module_name||ecx_utils.g_run_id;
1889 END IF;
1890 p_aflog_module_name := p_aflog_module_name||'.log';
1891
1892 ecx_debug.enable_debug_new(i_debug_level,ecx_utils.g_logdir,i_logfile, p_aflog_module_name);
1893 END IF;
1894
1895 /* Assign local variables with the ecx_debug global variables*/
1896 l_procedure := ecx_debug.g_procedure;
1897 l_statement := ecx_debug.g_statement;
1898 l_unexpected := ecx_debug.g_unexpected;
1899 l_procedureEnabled := ecx_debug.g_procedureEnabled;
1900 l_statementEnabled := ecx_debug.g_statementEnabled;
1901 l_unexpectedEnabled := ecx_debug.g_unexpectedEnabled;
1902
1903 if (l_procedureEnabled) then
1904 ecx_debug.push(i_method_name);
1905 end if;
1906
1907 if(l_statementEnabled) then
1908 ecx_debug.log(l_statement,'i_msgid',i_msgid,i_method_name);
1909 ecx_debug.log(l_statement,'i_debug_level',i_debug_level,i_method_name);
1910 end if;
1911 ecx_utils.g_document_id :=m_internal_control_number;
1912
1913 IF (ecx_logging_enabled and g_instlmode = 'STANDALONE') THEN
1914 ecx_utils.g_logfile :=i_logfile;
1915 END IF;
1916
1917 /*ecx_utils.g_direction := 'IN';
1918
1919 ecx_utils.g_transaction_type := m_transaction_type;
1920 ecx_utils.g_transaction_subtype := m_transaction_subtype;
1921 ecx_utils.g_msgid := i_msgid;*/
1922
1923 /*begin
1924 select standard_id
1925 into ecx_utils.g_standard_id
1926 from ecx_standards
1927 where standard_code = m_message_standard
1928 and standard_type = nvl(m_message_type, 'XML');
1929 if(l_statementEnabled) then
1930 ecx_debug.log(l_statement,'Standard id',ecx_utils.g_standard_id,i_method_name);
1931 end if;
1932 exception
1933 when others then
1934 ecx_debug.setErrorInfo(1,30,'ECX_UNSUPPORTED_STANDARD');
1935 raise ecx_utils.program_exit;
1936 enid;*/
1937 validate_message
1938 (
1939 i_msgid,
1940 m_message_standard,
1941 m_transaction_type,
1942 m_transaction_subtype,
1943 m_party_ext_code,
1944 m_document_number,
1945 m_routing_ext_code,
1946 m_payload,
1947 m_message_type
1948 );
1949
1950 if (l_procedureEnabled) then
1951 ecx_debug.pop(i_method_name);
1952 end if;
1953 IF (ecx_logging_enabled ) THEN
1954 ecx_debug.print_log;
1955 ecx_debug.disable_debug;
1956 END IF;
1957
1958 exception
1959 when ecx_utils.program_exit then
1960 --ecx_utils.g_map_id := -1;
1961 if(l_unexpectedEnabled) then
1962 --ecx_debug.log(l_unexpected,ecx_utils.i_errbuf,i_method_name);
1963 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
1964 end if;
1965 if (l_procedureEnabled) then
1966 ecx_debug.pop(i_method_name);
1967 end if;
1968
1969 IF (ecx_logging_enabled ) THEN
1970 ecx_debug.print_log;
1971 ecx_debug.disable_debug;
1972 END IF;
1973
1974 raise;
1975 when msg_not_found then
1976 --ecx_utils.g_map_id := -1;
1977 ecx_debug.setErrorInfo(1,30,'ECX_MSGID_NOT_FOUND',
1978 'p_msgid',
1979 i_msgid);
1980 close get_msg;
1981 raise;
1982 when others then
1983 --ecx_utils.g_map_id := -1;
1984 ecx_debug.setErrorInfo(2,30,SQLERRM || ' - ECX_INBOUND_TRIG.WRAP_VALIDATE_MESSAGE');
1985 if(l_unexpectedEnabled) then
1986 --ecx_debug.log(l_unexpected,ecx_utils.i_errbuf,i_method_name);
1987 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
1988 end if;
1989 if (l_procedureEnabled) then
1990 ecx_debug.pop(i_method_name);
1991 end if;
1992
1993 IF (ecx_logging_enabled ) THEN
1994 ecx_debug.print_log;
1995 ecx_debug.disable_debug;
1996 END IF;
1997
1998 raise;
1999 end wrap_validate_message;
2000
2001 /**
2002 Old wrap validate message - pre BES integration.
2003 Present for backward compatibility.
2004 **/
2005 procedure wrap_validate_message
2006 (
2007 i_msgid IN RAW,
2008 i_debug_level IN pls_integer,
2009 i_trigger_id OUT NOCOPY pls_integer
2010 )
2011 is
2012 i_method_name varchar2(2000) := 'ecx_inbound_trig.wrap_validate_message';
2013 i_logdir varchar2(200);
2014 i_logfile varchar2(200);
2015 PRAGMA AUTONOMOUS_TRANSACTION;
2016 msg_not_found exception;
2017
2018 m_transaction_type varchar2(200);
2019 m_transaction_subtype varchar2(200);
2020 m_message_standard varchar2(200);
2021 m_message_type varchar2(200);
2022 m_document_number varchar2(200);
2023 m_routing_ext_code varchar2(200);
2024 m_party_ext_code varchar2(200);
2025 m_payload CLOB;
2026 m_internal_control_number pls_integer;
2027
2028 cursor get_run_s
2029 is
2030 select ecx_output_runs_s.NEXTVAL
2031 from dual;
2032
2033
2034 cursor get_msg
2035 (
2036 p_msgid in raw
2037 )
2038 is
2039 select message_standard,
2040 message_type,
2041 transaction_type,
2042 transaction_subtype,
2043 party_site_id,
2044 payload,
2045 document_number,
2046 attribute3,
2047 internal_control_number
2048 from ecx_doclogs
2049 where msgid = p_msgid
2050 for update;
2051 p_aflog_module_name VARCHAR2(2000) ;
2052
2053 -- logging enabled
2054 ecx_logging_enabled boolean := false;
2055 logging_enabled varchar2(20);
2056 module varchar2(2000);
2057
2058 begin
2059 ecx_utils.g_logfile :=null;
2060 ecx_debug.g_v_module_name :='ecx.plsql.';
2061 fnd_profile.get('AFLOG_ENABLED',logging_enabled);
2062 fnd_profile.get('AFLOG_MODULE',module);
2063 if(logging_enabled = 'Y' AND ((lower(module) like 'ecx%'
2064 AND instr(lower(ecx_debug.g_v_module_name),rtrim(lower(module),'%'))> 0)
2065 OR module='%')
2066 AND FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_UNEXPECTED) then
2067 ecx_logging_enabled := true;
2068 end if;
2069 -- /logging enabled
2070
2071 open get_msg (i_msgid);
2072 fetch get_msg
2073 into m_message_standard,
2074 m_message_type,
2075 m_transaction_type,
2076 m_transaction_subtype,
2077 m_party_ext_code,
2078 m_payload,
2079 m_document_number,
2080 m_routing_ext_code,
2081 m_internal_control_number;
2082
2083 if get_msg%NOTFOUND
2084 then
2085 close get_msg;
2086 raise msg_not_found;
2087 end if;
2088
2089 close get_msg;
2090
2091 IF (ecx_logging_enabled ) THEN
2092 /**
2093 Fetch the Run Id for the Transaction
2094 **/
2095 open get_run_s;
2096 fetch get_run_s
2097 into ecx_utils.g_run_id;
2098 close get_run_s;
2099
2100 --get the Log directory from the Profile Option.
2101 ecx_utils.getLogDirectory;
2102
2103 i_logfile := m_message_standard||'IN'||m_transaction_type||m_transaction_subtype||ecx_utils.g_run_id||'.log';
2104
2105 p_aflog_module_name := '';
2106 IF (m_message_standard is not null) THEN
2107 p_aflog_module_name := p_aflog_module_name||m_message_standard||'.';
2108 END IF;
2109 p_aflog_module_name := p_aflog_module_name || 'in.';
2110 IF (m_transaction_type is not null) THEN
2111 p_aflog_module_name := p_aflog_module_name||m_transaction_type||'.';
2112 END IF;
2113 IF (m_transaction_subtype is not null) THEN
2114 p_aflog_module_name := p_aflog_module_name||m_transaction_subtype||'.';
2115 END IF;
2116 IF (ecx_utils.g_run_id is not null) THEN
2117 p_aflog_module_name := p_aflog_module_name||ecx_utils.g_run_id;
2118 END IF;
2119 p_aflog_module_name := p_aflog_module_name||'.log';
2120
2121 ecx_debug.enable_debug_new(i_debug_level,ecx_utils.g_logdir,i_logfile, p_aflog_module_name);
2122 END IF;
2123
2124 /* Assign local variables with the ecx_debug global variables*/
2125 l_procedure := ecx_debug.g_procedure;
2126 l_statement := ecx_debug.g_statement;
2127 l_unexpected := ecx_debug.g_unexpected;
2128 l_procedureEnabled := ecx_debug.g_procedureEnabled;
2129 l_statementEnabled := ecx_debug.g_statementEnabled;
2130 l_unexpectedEnabled := ecx_debug.g_unexpectedEnabled;
2131
2132 if (l_procedureEnabled) then
2133 ecx_debug.push(i_method_name);
2134 end if;
2135
2136 if(l_statementEnabled) then
2137 ecx_debug.log(l_statement,'i_msgid',i_msgid,i_method_name);
2138 ecx_debug.log(l_statement,'i_debug_level',i_debug_level,i_method_name);
2139 end if;
2140 ecx_utils.g_document_id :=m_internal_control_number;
2141
2142 IF (ecx_logging_enabled ) THEN
2143 ecx_utils.g_logfile :=i_logfile;
2144 END IF;
2145
2146 ecx_utils.g_direction := 'IN';
2147
2148 ecx_utils.g_transaction_type := m_transaction_type;
2149 ecx_utils.g_transaction_subtype := m_transaction_subtype;
2150 ecx_utils.g_msgid := i_msgid;
2151
2152 begin
2153 select standard_id
2154 into ecx_utils.g_standard_id
2155 from ecx_standards
2156 where standard_code = m_message_standard
2157 and standard_type = nvl(m_message_type, 'XML');
2158 if(l_statementEnabled) then
2159 ecx_debug.log(l_statement,'Standard id',ecx_utils.g_standard_id,i_method_name);
2160 end if;
2161 exception
2162 when others then
2163 ecx_debug.setErrorInfo(1,30,'ECX_UNSUPPORTED_STANDARD');
2164 raise ecx_utils.program_exit;
2165 end;
2166
2167 validate_message
2168 (
2169 i_msgid,
2170 m_message_standard,
2171 m_transaction_type,
2172 m_transaction_subtype,
2173 m_party_ext_code,
2174 m_document_number,
2175 m_routing_ext_code,
2176 m_payload,
2177 m_message_type
2178 );
2179
2180 if (l_procedureEnabled) then
2181 ecx_debug.pop(i_method_name);
2182 end if;
2183 IF (ecx_logging_enabled ) THEN
2184 ecx_debug.print_log;
2185 ecx_debug.disable_debug;
2186 END IF;
2187
2188 commit;
2189 exception
2190 when ecx_utils.program_exit then
2191 --ecx_utils.g_map_id := -1;
2192 if(l_unexpectedEnabled) then
2193 --ecx_debug.log(l_unexpected,ecx_utils.i_errbuf,i_method_name);
2194 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
2195 end if;
2196 IF (ecx_logging_enabled ) THEN
2197 ecx_debug.print_log;
2198 ecx_debug.disable_debug;
2199 END IF;
2200 rollback;
2201 when msg_not_found then
2202 --ecx_utils.g_map_id := -1;
2203 ecx_debug.setErrorInfo(1,30,'ECX_MSGID_NOT_FOUND',
2204 'p_msgid',
2205 i_msgid);
2206 close get_msg;
2207 rollback;
2208 when others then
2209 --ecx_utils.g_map_id := -1;
2210 ecx_debug.setErrorInfo(2,30,SQLERRM || ' - ECX_INBOUND_TRIG.WRAP_VALIDATE_MESSAGE');
2211 if(l_unexpectedEnabled) then
2212 --ecx_debug.log(l_unexpected,ecx_utils.i_errbuf,i_method_name);
2213 ecx_debug.log(l_unexpected,ecx_debug.getMessage(ecx_utils.i_errbuf,ecx_utils.i_errparams),i_method_name);
2214 end if;
2215 IF (ecx_logging_enabled ) THEN
2216 ecx_debug.print_log;
2217 ecx_debug.disable_debug;
2218 END IF;
2219
2220 rollback;
2221 end wrap_validate_message;
2222
2223 procedure processXML
2224 (
2225 i_map_code IN varchar2,
2226 i_payload IN CLOB,
2227 i_debug_level IN pls_integer,
2228 i_ret_code OUT NOCOPY pls_integer,
2229 i_errbuf OUT NOCOPY varchar2,
2230 i_log_file OUT NOCOPY varchar2,
2231 o_payload OUT NOCOPY CLOB,
2232 i_message_standard IN varchar2,
2233 i_message_type IN varchar2
2234 )
2235 is
2236 i_method_name varchar2(2000) := 'ecx_inbound_trig.processxml';
2237 i_logdir varchar2(200);
2238 i_logfile varchar2(200);
2239 i_map_id pls_integer;
2240 g_instlmode VARCHAR2(100);
2241
2242 cursor get_run_s
2243 is
2244 select ecx_output_runs_s.NEXTVAL
2245 from dual;
2246
2247 ecx_logging_enabled boolean := false;
2248 logging_enabled varchar2(20);
2249 module varchar2(2000);
2250
2251 begin
2252 g_instlmode := wf_core.translate('WF_INSTALL');
2253
2254 if(g_instlmode = 'EMBEDDED')
2255 THEN
2256 fnd_profile.get('AFLOG_ENABLED',logging_enabled);
2257 fnd_profile.get('AFLOG_MODULE',module);
2258 if(logging_enabled = 'Y' AND ((lower(module) like 'ecx%'
2259 AND instr(lower(ecx_debug.g_v_module_name),rtrim(lower(module),'%'))> 0)
2260 OR module='%')
2261 AND FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_UNEXPECTED) then
2262 ecx_logging_enabled := true;
2263 end if;
2264 elsif(g_instlmode = 'STANDALONE')
2265 then
2266 if (i_debug_level > 0) then
2267 ecx_logging_enabled := true;
2268 end if;
2269 end if;
2270
2271 IF (ecx_logging_enabled ) THEN
2272 /**
2273 Fetch the Run Id for the Transaction
2274 **/
2275 open get_run_s;
2276 fetch get_run_s
2277 into ecx_utils.g_run_id;
2278 close get_run_s;
2279
2280 --get the Log directory from the Profile Option.
2281 ecx_utils.getLogDirectory;
2282 i_logfile := 'IN'||ecx_utils.g_run_id||'.log';
2283 END IF;
2284
2285 IF g_instlmode = 'EMBEDDED' THEN
2286 IF (ecx_logging_enabled ) THEN
2287 i_log_file := ecx_debug.g_sqlprefix || 'in.'||ecx_utils.g_run_id||'.log';
2288 ELSE
2289 i_log_file := 'Please ensure that FND-Logging is enabled for module '||ecx_debug.g_sqlprefix||'%';
2290 END IF;
2291 ELSE
2292 IF (ecx_logging_enabled ) THEN
2293 i_log_file := ecx_utils.g_logdir||'/'||i_logfile;
2294 ELSE
2295 i_log_file := 'Please ensure that logging is enabled';
2296 END IF;
2297 END IF;
2298
2299 IF (ecx_logging_enabled ) THEN
2300 ecx_debug.enable_debug_new(i_debug_level,ecx_utils.g_logdir,i_logfile, 'in.'||ecx_utils.g_run_id||'.log');
2301 END IF;
2302
2303 /* Assign local variables with the ecx_debug global variables*/
2304 l_procedure := ecx_debug.g_procedure;
2305 l_statement := ecx_debug.g_statement;
2306 l_unexpected := ecx_debug.g_unexpected;
2307 l_procedureEnabled := ecx_debug.g_procedureEnabled;
2308 l_statementEnabled := ecx_debug.g_statementEnabled;
2309 l_unexpectedEnabled := ecx_debug.g_unexpectedEnabled;
2310
2311 if (l_procedureEnabled) then
2312 ecx_debug.push(i_method_name);
2313 end if;
2314
2315 if(l_statementEnabled) then
2316 ecx_debug.log(l_statement,'i_map_code',i_map_code,i_method_name);
2317 ecx_debug.log(l_statement,'i_debug_level',i_debug_level,i_method_name);
2318 end if;
2319
2320 IF (ecx_logging_enabled ) THEN
2321 ecx_utils.g_logfile :=i_logfile;
2322 END IF;
2323 ecx_utils.g_direction := 'IN';
2324
2325 begin
2326 select map_id
2327 into i_map_id
2328 from ecx_mappings
2329 where map_code = i_map_code;
2330 exception
2331 when others then
2332 ecx_debug.setErrorInfo(2,30,'ECX_MAP_NOT_FOUND',
2333 'MAP_CODE',
2334 i_map_code);
2335 raise ecx_utils.program_exit;
2336 end;
2337
2338 begin
2339 select standard_id
2340 into ecx_utils.g_standard_id
2341 from ecx_standards
2342 where standard_code = i_message_standard
2343 and standard_type = nvl(i_message_type, 'XML');
2344 if(l_statementEnabled) then
2345 ecx_debug.log(l_statement,'Standard id',ecx_utils.g_standard_id,i_method_name);
2346 end if;
2347 exception
2348 when others then
2349 ecx_debug.setErrorInfo(1,30,'ECX_UNSUPPORTED_STANDARD');
2350 raise ecx_utils.program_exit;
2351 end;
2352
2353 processXMLData
2354 (
2355 i_map_id,
2356 i_payload,
2357 null,
2358 null,
2359 i_message_standard,
2360 o_payload,
2361 i_message_type
2362 );
2363
2364 --ecx_utils.i_ret_code :=0;
2365 --ecx_utils.i_errbuf := 'XML Document Successfully processed';
2366 ecx_debug.setErrorInfo(0,10,'ECX_DOCUMENT_PROCESSED');
2367
2368 if(ecx_utils.i_ret_code = 0 ) then
2369 if(l_statementEnabled) then
2370 ecx_debug.log(l_statement, 'Ret Code',ecx_utils.i_ret_code,i_method_name);
2371 ecx_debug.log(l_statement, 'Ret Msg ',ecx_utils.i_errbuf,i_method_name);
2372 end if;
2373 else
2374 if(l_unexpectedEnabled) then
2375 ecx_debug.log(l_unexpected, 'Ret Code',ecx_utils.i_ret_code,i_method_name);
2376 ecx_debug.log(l_unexpected, 'Ret Msg ',ecx_utils.i_errbuf,i_method_name);
2377 end if;
2378 end if;
2379
2380 if (l_procedureEnabled) then
2381 ecx_debug.pop(i_method_name);
2382 end if;
2383
2384 IF (ecx_logging_enabled ) THEN
2385 ecx_debug.print_log;
2386 ecx_debug.disable_debug;
2387 END IF;
2388
2389 i_ret_code := ecx_utils.i_ret_code;
2390 i_errbuf := ecx_utils.i_errbuf;
2391
2392 exception
2393 when ecx_utils.program_exit then
2394 --dbms_lob.freetemporary(o_payload);
2395 --ecx_utils.g_map_id := -1;
2396 if(l_unexpectedEnabled) then
2397 ecx_debug.log(l_unexpected,'Ret Code',ecx_utils.i_ret_code,i_method_name);
2398 ecx_debug.log(l_unexpected, 'Ret Msg ',ecx_debug.getMessage(ecx_utils.i_errbuf,
2399 ecx_utils.i_errparams),i_method_name);
2400 end if;
2401 if (l_procedureEnabled) then
2402 ecx_debug.pop(i_method_name);
2403 end if;
2404 IF (ecx_logging_enabled ) THEN
2405 ecx_debug.print_log;
2406 ecx_debug.disable_debug;
2407 END IF;
2408 i_ret_code := ecx_utils.i_ret_code;
2409 i_errbuf := ecx_utils.i_errbuf;
2410
2411 when others then
2412 --dbms_lob.freetemporary(o_payload);
2413 --ecx_utils.g_map_id := -1;
2414 ecx_debug.setErrorInfo(2,30,SQLERRM || ' - ECX_INBOUND_TRIG.WRAP_VALIDATE_MESSAGE');
2415 if(l_unexpectedEnabled) then
2416 ecx_debug.log(l_unexpected,'Ret Code',ecx_utils.i_ret_code,i_method_name);
2417 ecx_debug.log(l_unexpected, 'Ret Msg ',ecx_debug.getMessage(ecx_utils.i_errbuf,
2418 ecx_utils.i_errparams),i_method_name);
2419 end if;
2420 if (l_procedureEnabled) then
2421 ecx_debug.pop(i_method_name);
2422 end if;
2423 IF (ecx_logging_enabled ) THEN
2424 ecx_debug.print_log;
2425 ecx_debug.disable_debug;
2426 END IF;
2427 i_ret_code := ecx_utils.i_ret_code;
2428 i_errbuf := ecx_utils.i_errbuf;
2429 end processXML;
2430
2431
2432 procedure reprocess
2433 (
2434 i_msgid IN RAW,
2435 i_debug_level IN pls_integer,
2436 i_trigger_id OUT NOCOPY number,
2437 i_retcode OUT NOCOPY pls_integer,
2438 i_errbuf OUT NOCOPY varchar2
2439 )
2440 is
2441 i_process_id raw(16);
2442 cursor c_ecx_trigger_id
2443 is
2444 select ecx_trigger_id_s.NEXTVAL
2445 from dual;
2446
2447 begin
2448 /* open c_ecx_trigger_id;
2449 fetch c_ecx_trigger_id into i_trigger_id;
2450 close c_ecx_trigger_id;*/
2451 ecx_debug.setErrorInfo(10,10,'ECX_REPROCESSING_MESSAGE');
2452 /* ecx_errorlog.inbound_trigger
2453 (
2454 i_trigger_id,
2455 i_msgid,
2456 null,
2457 ecx_utils.i_ret_code,
2458 ecx_utils.i_errbuf
2459 );
2460
2461 */
2462
2463 begin
2464 ecx_inbound_trig.wrap_validate_message
2465 (
2466 i_msgid,
2467 i_debug_level
2468 );
2469
2470 ecx_debug.setErrorInfo(0,10,'ECX_MESSAGE_REPROCESSED');
2471 select process_id into i_process_id from ecx_inbound_logs where msgid=i_msgid;
2472 if(i_process_id is null) -- means TP setup wrong. Message never got into transaction queue.
2473 then
2474 return;
2475 end if;
2476 ecx_errorlog.inbound_engine(i_process_id,ecx_utils.i_ret_code,
2477 ecx_utils.i_errbuf);
2478 ecx_utils.g_logfile := null;
2479 exception
2480 when others then
2481 ecx_errorlog.inbound_engine(i_process_id,ecx_utils.i_ret_code, ecx_utils.i_errbuf,ecx_utils.i_errparams);
2482 i_retcode := ecx_utils.i_ret_code;
2483 i_errbuf := ecx_utils.i_errbuf;
2484 ecx_utils.g_logfile := null;
2485 end;
2486
2487 --Changed for MLS
2488 ecx_debug.setErrorInfo(0,10,'ECX_MESSAGE_REPROCESSED');
2489 i_retcode := ecx_utils.i_ret_code;
2490 i_errbuf := ecx_utils.i_errbuf;
2491 exception
2492 when others then
2493 i_retcode := ecx_utils.i_ret_code;
2494 i_errbuf := ecx_utils.i_errbuf;
2495 raise;
2496 end reprocess;
2497
2498 end ecx_inbound_trig;