[Home] [Help]
PACKAGE BODY: APPS.WSH_U_CSPV
Source
1 PACKAGE BODY WSH_U_CSPV AS
2 /* $Header: WSHUCSPB.pls 120.0.12020000.5 2013/02/15 00:00:02 adagur ship $ */
3
4 -- standard global constants
5 G_PKG_NAME CONSTANT VARCHAR2(30) := 'WSH_U_CSPV';
6 p_message_type CONSTANT VARCHAR2(1) := 'E';
7
8
9
10
11
12
13
14 -- -------------------------------------------------------------------
15 -- Start of comments
16 -- API name : CSP_Validate
17 -- Type : public
18 -- Function : compose the input string, call UPS APIs and parse
19 -- the L_OUTPUT string, place them in the returning
20 --
21 -- Version : Initial version 1.0
22 -- Notes
23 --
24 -- End of comments
25 -- ---------------------------------------------------------------------
26 PROCEDURE CSP_Validate
27 ( p_api_version IN NUMBER
28 , p_init_msg_list IN VARCHAR2
29 , x_return_status OUT NOCOPY VARCHAR2
30 , x_msg_count OUT NOCOPY NUMBER
31 , x_msg_data OUT NOCOPY VARCHAR2
32 , p_AppVersion IN VARCHAR2
33 , p_AcceptLicenseAgreement IN VARCHAR2
34 , p_ResponseType IN VARCHAR2
35 , p_request_in IN CSPValidateInRec
36 , x_CSPValidate_out OUT NOCOPY CSPValidateOutTblTyp
37 )
38 IS
39
40 -- standard version infermation
41 l_api_version CONSTANT NUMBER := 1.0;
42 l_api_name CONSTANT VARCHAR2(30) := 'CSP_VALIDATE';
43
44 -- standard variables
45 l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
46 l_msg_count NUMBER := 0;
47 l_msg_data VARCHAR2(2000) := NULL;
48 l_msg_summary VARCHAR2(2000);
49 l_msg_details VARCHAR2(4000);
50
51 l_csp_validate_req_in cspvalidateinrec; --Added for Carrier Services Integration with Shipping project Bug 16095594
52
53 -- L_UPS_URL VARCHAR2(200) := 'http://wwwapps.ups.com/using/sevices/cszval/cszval_dss.cgi';
54 /*Commented for Carrier Services Integration with Shipping project Bug 16095594
55 l_ups_url VARCHAR2(1000) := NULL;
56 l_internet_proxy VARCHAR2(1000) := NULL;
57
58 l_boundary_string_start NUMBER := 0;
59 l_boundary_string_end NUMBER := 0;
60 l_boundary_string VARCHAR2(100) := NULL;
61 L_Content_Str_Len NUMBER := 0;
62 l_request_in CSPValidateInRec;
63 l_input_str VARCHAR2(2000);
64 l_output_str VARCHAR2(10000);
65 l_output_data utl_http.html_pieces;
66 L_CSPV_Message VARCHAR2(500);
67
68 L_Content_Type VARCHAR2(200);
69
70 L_Locate_boundary NUMBER := 1;
71 L_Locate_Str_Len NUMBER := 1;
72 L_Locate_Str_Len_End NUMBER := 0;
73 L_Locate_Content NUMBER :=1;
74 L_Locate_boundary_End NUMBER := 1;
75 L_Locate_Begin NUMBER := 1;
76 L_Token_Start NUMBER := 1;
77 L_Token_End NUMBER := 0;
78 l_find_error NUMBER := 0;
79
80 -- this is used to print the debug message only
81 l_outrec_index BINARY_INTEGER := 0;
82
83 WSH_U_INPUT_PARAMETER exception;
84 WSH_U_CAR_URL exception;
85
86 WSH_U_PROXY exception;
87 WSH_U_APPVER exception;
88 WSH_U_LICAGRE exception;
89 WSH_U_RESTYP exception;
90 WSH_U_CSP exception;
91 WSH_U_CITYORZIP exception;
92 WSH_U_NO_HOST exception;
93 REQUEST_FAILED exception;
94 INIT_FAILED exception;
95 End of Comment Commented for Carrier Services Integration with Shipping project Bug 16095594*/
96 l_CSPValidate_out WSH_U_CSPV.CSPValidateOutTblTyp; --Added for Carrier Services Integration with Shipping project Bug 16095594
97 --
98 l_debug_on BOOLEAN;
99 --
100 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'CSP_VALIDATE';
101 --
102 BEGIN
103 -- Standard call to check for call compatibility.
104 --
105 -- Debug Statements
106 --
107 --
108 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
109 --
110 IF l_debug_on IS NULL
111 THEN
112 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
113 END IF;
114 --
115 IF l_debug_on THEN
116 WSH_DEBUG_SV.push(l_module_name);
117 --
118 WSH_DEBUG_SV.log(l_module_name,'P_API_VERSION',P_API_VERSION);
119 WSH_DEBUG_SV.log(l_module_name,'P_INIT_MSG_LIST',P_INIT_MSG_LIST);
120 WSH_DEBUG_SV.log(l_module_name,'P_APPVERSION',P_APPVERSION);
121 WSH_DEBUG_SV.log(l_module_name,'P_ACCEPTLICENSEAGREEMENT',P_ACCEPTLICENSEAGREEMENT);
122 WSH_DEBUG_SV.log(l_module_name,'P_RESPONSETYPE',P_RESPONSETYPE);
123 END IF;
124 --
125 IF NOT FND_API.compatible_api_call
126 ( l_api_version
127 , p_api_version
128 , l_api_name
129 , G_PKG_NAME)
130 THEN
131 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
132 END IF;
133
134 -- Check p_init_msg_list
135 IF FND_API.to_boolean(p_init_msg_list)
136 THEN
137 FND_MSG_PUB.initialize;
138 END IF;
139
140 -- initialize API return status to success
141 x_return_status := FND_API.G_RET_STS_SUCCESS;
142 x_msg_count := 0;
143 x_msg_data := NULL;
144
145 -- program specific logic begins here
146 -- initialize global variables
147 l_csp_validate_req_in := p_request_in;
148
149 --Added for Carrier Services Integration with Shipping project Bug 16095594
150 IF l_debug_on THEN
151 WSH_DEBUG_SV.log(l_module_name,'Entity Called is '||l_csp_validate_req_in.Entity);
152 WSH_DEBUG_SV.log(l_module_name,'EntityId is '||l_csp_validate_req_in.Entity_Id);
153 END IF;
154
155 wsh_custom_pub.csp_shipment_services
156 ( p_request_in => l_csp_validate_req_in
157 , x_cspvalidate_out => l_cspvalidate_out
158 , x_msg_count => l_msg_count
159 , x_msg_data => l_msg_data
160 , x_return_status => l_return_status);
161
162 IF l_return_status = FND_API.G_RET_STS_SUCCESS
163 THEN
164 x_return_status := l_return_status;
165 x_CSPValidate_out := l_cspvalidate_out;
166 ELSE
167 x_return_status := l_return_status;
168 x_msg_data := l_msg_data;
169 x_msg_count := l_msg_count;
170
171 END IF;
172
173
174 /*
175 l_request_in := p_request_in;
176
177
178 --
179 -- Debug Statements
180 --
181 IF l_debug_on THEN
182 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.GET_CARRIER_API_URL',WSH_DEBUG_SV.C_PROC_LEVEL);
183 END IF;
184 --
185 L_UPS_URL := WSH_U_UTIL.Get_Carrier_API_URL(
186 p_api_version => 1.0,
187 p_init_msg_list => FND_API.G_TRUE,
188 x_return_status => l_return_status,
189 x_msg_count => l_msg_count,
190 x_msg_data => l_msg_data,
191 p_Carrier_Name => 'UPS',
192 p_API_Name => 'CSP_VALIDATE');
193 if l_return_status <> FND_API.G_RET_STS_SUCCESS then
194 raise WSH_U_CAR_URL;
195 end if;
196
197 L_INPUT_STR := L_UPS_URL || '?';
198
199 -- ---------------------------------------------------------------
200 -- UPS standard parameters: AppVersion
201 -- AcceptLicenseAgreement
202 -- ResponseType
203 -- ---------------------------------------------------------------
204
205 -- AppVersion ---------------------------------------------------------
206 if( p_AppVersion IS NULL) then
207 raise WSH_U_APPVER;
208 -- p_AppVersion := '1.0';
209 end if;
210 L_INPUT_STR := L_INPUT_STR || 'AppVersion' ||'='|| p_AppVersion;
211
212 -- AcceptLicenseAgreement ---------------------------------------------
213 if( p_AcceptLicenseAgreement IS NULL) then
214 raise WSH_U_LICAGRE;
215 -- p_AcceptLicenseAgreement := 'YES';
216 end if;
217 L_INPUT_STR := L_INPUT_STR || '&' ||'AcceptUPSLicenseAgreement'||'=' || p_AcceptLicenseAgreement;
218
219 -- ResponseType --------------------------------------------------------
220 if( p_ResponseType IS NULL) then
221 raise WSH_U_RESTYP;
222 -- p_ResponseType := 'application/x-ups-cszval';
223 end if;
224 L_INPUT_STR := L_INPUT_STR || '&' || 'ResponseType' ||'='|| p_ResponseType;
225
226 -- ---------------------------------------------------------------
227 -- Program specific parameters start here
228 -- ---------------------------------------------------------------
229 if (l_request_in.City IS NULL and l_request_in.StateProv IS NULL
230 and l_request_in.PostalCode IS NULL) then
231 raise WSH_U_CSP;
232 end if;
233
234 -- --------------------------------------------------------------------
235 -- City is required if StateProv is NOT NULL and PostalCode is NULL
236 -- --------------------------------------------------------------------
237 if (l_request_in.City IS NULL) then
238 if (l_request_in.StateProv is NOT NULL and l_request_in.PostalCode
239 is NULL ) then
240
241 raise WSH_U_CITYORZIP;
242 end if;
243 else
244 L_INPUT_STR := L_INPUT_STR || '&' || 'City' ||'='|| l_request_in.City;
245 end if;
246
247 -- ----------------------------------------------------------------
248 -- StateProv cannot be specified without either City or PostalCode
249 -- ----------------------------------------------------------------
250 if(l_request_in.StateProv IS not NULL) then
251 if (l_request_in.City IS NULL and l_request_in.PostalCode is NULL) then
252 raise WSH_U_CITYORZIP;
253 end if;
254 L_INPUT_STR := L_INPUT_STR || '&' || 'StateProv'||'=' || l_request_in.StateProv;
255 end if;
256
257 -- -------------------------------------------------------------------
258 -- PostalCode is required when StateProv is populated and City is not
259 -- provided
260 -- -------------------------------------------------------------------
261 if(l_request_in.PostalCode IS NULL) then
262 if (l_request_in.StateProv is NOT NULL and l_request_in.City is NULL) then
263 raise WSH_U_CITYORZIP;
264 end if;
265 else
266 L_INPUT_STR := L_INPUT_STR || '&' || 'PostalCode' ||'='|| l_request_in.PostalCode;
267 end if;
268
269 L_INPUT_STR := REPLACE(L_INPUT_STR, ' ', '+');
270
271 -- DBMS_OUTPUT.PUT_LINE('========== request begin =========');
272 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,0,50));
273 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,51,50));
274 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,101,50));
275 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,151,50));
276 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,201,50));
277 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,251,50));
278 -- DBMS_OUTPUT.PUT_LINE('========== request end =========');
279
280 -- clear variables before calling subroutine
281 l_return_status := FND_API.G_RET_STS_SUCCESS;
282 l_msg_count := 0;
283 l_msg_data := NULL;
284
285
286 -- get proxy server URL
287 --
288 -- Debug Statements
289 --
290 IF l_debug_on THEN
291 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.GET_PROXY',WSH_DEBUG_SV.C_PROC_LEVEL);
292 END IF;
293 --
294 L_INTERNET_PROXY := WSH_U_UTIL.Get_PROXY(
295 p_api_version => 1.0,
296 p_init_msg_list => FND_API.G_TRUE,
297 x_return_status => l_return_status,
298 x_msg_count => l_msg_count,
299 x_msg_data => l_msg_data);
300
301 if l_return_status <> FND_API.G_RET_STS_SUCCESS then
302 raise WSH_U_PROXY;
303 end if;
304 if L_INTERNET_PROXY is not NULL then
305 l_output_data := utl_http.request_pieces(L_INPUT_STR,100,L_INTERNET_PROXY);
306 else
307 l_output_data := utl_http.request_pieces(L_INPUT_STR,100);
308 end if;
309
310 -- when no response is received from a request to a given URL
311 -- then a formatted HTML error message may be returned, it contains the
312 -- following error message
313 l_find_error := INSTR(l_output_data(1), 'Can''t locate remote host');
314 if l_find_error <> 0 then
315 raise WSH_U_NO_HOST;
316 end if;
317
318
319 -- It is only good for up to 100 iteration else it will fail.
320 -- DBMS_OUTPUT.PUT_LINE('======= result begin =============');
321 FOR i in 1 .. l_output_data.count LOOP
322 L_OUTPUT_STR := L_OUTPUT_STR || l_output_data(i);
323 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1, 250));
324 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 251, 250));
325 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 501, 250));
326 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 751, 250));
327 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1001, 250));
328 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1251, 250));
329 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1501, 250));
330 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1751, 250));
331 END LOOP;
332
333 -- DBMS_OUTPUT.PUT_LINE('========== result end ===========');
334 l_boundary_string_start := INSTR(L_OUTPUT_STR, 'boundary=', 1 , 1);
335 if l_boundary_string_start <> 0 then
336 l_boundary_string_start := l_boundary_string_start + 9;
337 -- l_boundary_string_end := INSTR(L_OUTPUT_STR, '--', l_boundary_string_start,1);
338 l_boundary_string_end := INSTR(L_OUTPUT_STR, FND_GLOBAL.LOCAL_CHR(13), l_boundary_string_start,1);
339 l_boundary_string := SUBSTR(L_OUTPUT_STR,
340 l_boundary_string_start ,
341 l_boundary_string_end - l_boundary_string_start);
342 else
343
344 l_boundary_string := 'UPSBOUNDARY';
345 end if;
346 l_boundary_string := '--' || l_boundary_string;
347 -- DBMS_OUTPUT.PUT_LINE('Boundary String:'|| l_boundary_string);
348
349
350
351 LOOP
352
353 L_Locate_boundary :=INSTR(L_OUTPUT_STR, l_boundary_string ,L_Locate_boundary,1);
354 L_Locate_Content := INSTR(L_OUTPUT_STR,'Content-type',L_Locate_boundary,1);
355 -- DBMS_OUTPUT.PUT_LINE('LOCATE CONTENT IS************'||to_char(L_Locate_Content));
356 L_Locate_Str_Len := INSTR(L_OUTPUT_STR, 'Content-length',L_Locate_boundary,1);
357 -- DBMS_OUTPUT.PUT_LINE('LOCATE STR IS************'||to_char(L_Locate_Str_Len));
358 L_Locate_Begin := INSTR(L_OUTPUT_STR,'UPSOnLine',L_Locate_boundary,1);
359 -- DBMS_OUTPUT.PUT_LINE('LOCATE BEGIN IS************'||to_char(L_Locate_Begin));
360 L_Locate_boundary_End := INSTR(L_OUTPUT_STR, l_boundary_string ,L_Locate_boundary,2);
361 -- DBMS_OUTPUT.PUT_LINE('LOCATE boundary END************'||to_char(L_Locate_boundary_End));
362
363 IF(L_Locate_boundary_End > L_Locate_Begin) THEN
364
365 -- DBMS_OUTPUT.PUT_LINE('l_outrec_index BEGIN:' || to_char(l_outrec_index));
366 l_outrec_index := l_outrec_index + 1;
367 -- DBMS_OUTPUT.PUT_LINE('l_outrec_index END:' || to_char(l_outrec_index));
368
369
370 -- Get Content-length
371
372 L_Locate_Str_Len_End := INSTR(L_OUTPUT_STR, FND_GLOBAL.LOCAL_CHR(13), L_Locate_Str_Len, 1);
373 L_Content_Str_Len := TO_NUMBER(SUBSTR(L_OUTPUT_STR,(L_Locate_Str_Len+16),L_Locate_Str_Len_End - L_Locate_Str_Len - 16));
374
375 -- DBMS_OUTPUT.PUT_LINE('CONTENT STR LENGTH IS ***********'||to_char(L_Content_Str_Len));
376 L_Content_Type := SUBSTR(L_OUTPUT_STR,(L_Locate_Content + LENGTH('Content-type: application/')),(L_Locate_Str_Len - (L_Locate_Content + LENGTH('Content-type: application/'))));
377
378 L_CSPV_Message := SUBSTR(L_OUTPUT_STR, L_Locate_Begin, L_Content_Str_Len);
379 -- DBMS_OUTPUT.put_line('Message Is:'||L_CSPV_Message);
380 -- DBMS_OUTPUT.PUT_LINE('CONTENT_TYPE IS ************'||L_Content_Type||'*********');
381
382 if(SUBSTR(L_Content_Type,1,LENGTH('x-ups-cszval')) = 'x-ups-cszval' or
383 SUBSTR(L_Content_Type,1,LENGTH('x-ups-error')) = 'x-ups-error')
384 then
385 -- DBMS_OUTPUT.PUT_LINE('===<begin> ======');
386 L_Token_Start := 0;
387 L_Token_End := 0;
388
389
390 --
391 -- Debug Statements
392 --
393 IF l_debug_on THEN
394 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
395 END IF;
396 --
397 x_CSPValidate_out(l_outrec_index).UPSOnLine :=
398 WSH_U_UTIL.Calculate_Token(L_CSPV_Message,L_Token_Start,L_Token_End);
399
400 --
401 -- Debug Statements
402 --
403 IF l_debug_on THEN
404 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
405 END IF;
406 --
407 x_CSPValidate_out(l_outrec_index).AppVersion :=
408 WSH_U_UTIL.Calculate_Token(L_CSPV_Message, L_Token_Start,L_Token_End);
409
410 --
411 -- Debug Statements
412 --
413 IF l_debug_on THEN
414 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
415 END IF;
416 --
417 x_CSPValidate_out(l_outrec_index).ReturnCode :=
418 TO_NUMBER(WSH_U_UTIL.Calculate_Token(L_CSPV_Message, L_Token_Start,L_Token_End));
419 -- DBMS_OUTPUT.PUT_LINE('Return Code: ' || TO_CHAR(x_CSPValidate_out(l_outrec_index).ReturnCode));
420
421 --
422 -- Debug Statements
423 --
424 IF l_debug_on THEN
425 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
426 END IF;
427 --
428 x_CSPValidate_out(l_outrec_index).MessageText :=
429 WSH_U_UTIL.Calculate_Token(L_CSPV_Message, L_Token_Start,L_Token_End);
430
431 x_CSPValidate_out(l_outrec_index).MessageNumber :=
432 TO_NUMBER(SUBSTR(x_CSPValidate_out(l_outrec_index).MessageText,1,4));
433 -- DBMS_OUTPUT.PUT_LINE('MessageNumber: ' || TO_CHAR(x_CSPValidate_out(l_outrec_index).MessageNumber));
434 x_CSPValidate_out(l_outrec_index).MessageText :=
435 SUBSTR(x_CSPValidate_out(l_outrec_index).MessageText,5,(LENGTH(x_CSPValidate_out(l_outrec_index).MessageText)-4));
436 -- DBMS_OUTPUT.PUT_LINE('MessageText: ' || x_CSPValidate_out(l_outrec_index).MessageText);
437
438 if (x_CSPValidate_out(l_outrec_index).ReturnCode = 0) then
439
440 --
441 -- Debug Statements
442 --
443 IF l_debug_on THEN
444 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
445 END IF;
446 --
447 x_CSPValidate_out(l_outrec_index).Rank :=
448 TO_NUMBER(WSH_U_UTIL.Calculate_Token(L_CSPV_Message, L_Token_Start,L_Token_End));
449
450 --
451 -- Debug Statements
452 --
453 IF l_debug_on THEN
454 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
455 END IF;
456 --
457 x_CSPValidate_out(l_outrec_index).Quality :=
458 TO_NUMBER(WSH_U_UTIL.Calculate_Token(L_CSPV_Message, L_Token_Start,L_Token_End));
459
460 --
461 -- Debug Statements
462 --
463 IF l_debug_on THEN
464 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
465 END IF;
466 --
467 x_CSPValidate_out(l_outrec_index).City :=
468 WSH_U_UTIL.Calculate_Token(L_CSPV_Message, L_Token_Start,L_Token_End);
469
470 --
471 -- Debug Statements
472 --
473 IF l_debug_on THEN
474 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
475 END IF;
476 --
477 x_CSPValidate_out(l_outrec_index).StateProv :=
478 WSH_U_UTIL.Calculate_Token(L_CSPV_Message, L_Token_Start,L_Token_End);
479
480 --
481 -- Debug Statements
482 --
483 IF l_debug_on THEN
484 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
485 END IF;
486 --
487 x_CSPValidate_out(l_outrec_index).PostalCodeLow :=
488 WSH_U_UTIL.Calculate_Token(L_CSPV_Message, L_Token_Start,L_Token_End);
489
490 --
491 -- Debug Statements
492 --
493 IF l_debug_on THEN
494 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
495 END IF;
496 --
497 x_CSPValidate_out(l_outrec_index).PostalCodeHigh :=
498 WSH_U_UTIL.Calculate_Token(L_CSPV_Message, L_Token_Start,L_Token_End);
499
500 else
501 x_CSPValidate_out(l_outrec_index).Rank := NULL;
502
503 x_CSPValidate_out(l_outrec_index).Quality := NULL;
504
505 x_CSPValidate_out(l_outrec_index).City := NULL;
506
507 x_CSPValidate_out(l_outrec_index).StateProv := NULL;
508
509 x_CSPValidate_out(l_outrec_index).PostalCodeLow := NULL;
510
511 x_CSPValidate_out(l_outrec_index).PostalCodeHigh := NULL;
512
513 end if;
514 -- DBMS_OUTPUT.PUT_LINE('===<end> === application/x-ups-cszval ===');
515 end if;
516
517
518 END IF;
519
520 -- advance to next UPSBOUNDARYUPS section
521 L_Locate_boundary := L_Locate_boundary_End;
522
523 EXIT WHEN L_Locate_Begin = 0;
524
525 END LOOP;
526
527
528 */
529
530 --
531 -- Debug Statements
532 --
533 IF l_debug_on THEN
534 WSH_DEBUG_SV.pop(l_module_name);
535 END IF;
536 --
537 EXCEPTION
538
539 /*Comment Commented for Carrier Services Integration with Shipping project Bug 16095594
540 WHEN WSH_U_CAR_URL THEN
541 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_CAR_URL');
542 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
543 x_return_status := FND_API.G_RET_STS_ERROR;
544 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
545 if x_msg_count > 1 then
546 x_msg_data := l_msg_summary || l_msg_details;
547 else
548 x_msg_data := l_msg_summary;
549 end if;
550
551 --
552 -- Debug Statements
553 --
554 IF l_debug_on THEN
555 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_CAR_URL exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
556 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_CAR_URL');
557 END IF;
558
559 WHEN WSH_U_NO_HOST THEN
560 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_NO_HOST');
561 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
562 x_return_status := FND_API.G_RET_STS_ERROR;
563 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
564 if x_msg_count > 1 then
565 x_msg_data := l_msg_summary || l_msg_details;
566 else
567 x_msg_data := l_msg_summary;
568 end if;
569
570 --
571 -- Debug Statements
572 --
573 IF l_debug_on THEN
574 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_NO_HOST exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
575 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_NO_HOST');
576 END IF;
577 --
578 WHEN REQUEST_FAILED THEN
579 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_REQUEST_FAILED');
580 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
581 x_return_status := FND_API.G_RET_STS_ERROR;
582 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
583 if x_msg_count > 1 then
584 x_msg_data := l_msg_summary || l_msg_details;
585 else
586 x_msg_data := l_msg_summary;
587 end if;
588
589 --
590 -- Debug Statements
591 --
592 IF l_debug_on THEN
593 WSH_DEBUG_SV.logmsg(l_module_name,'REQUEST_FAILED exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
594 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:REQUEST_FAILED');
595 END IF;
596 --
597 WHEN INIT_FAILED THEN
598 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_INIT_FAILED');
599 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
600 x_return_status := FND_API.G_RET_STS_ERROR;
601 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
602 if x_msg_count > 1 then
603 x_msg_data := l_msg_summary || l_msg_details;
604 else
605 x_msg_data := l_msg_summary;
606 end if;
607
608 --
609 -- Debug Statements
610 --
611 IF l_debug_on THEN
612 WSH_DEBUG_SV.logmsg(l_module_name,'INIT_FAILED exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
613 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INIT_FAILED');
614 END IF;
615 --
616 WHEN WSH_U_PROXY THEN
617 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_PROXY');
618 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
619 x_return_status := FND_API.G_RET_STS_ERROR;
620 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
621 if x_msg_count > 1 then
622 x_msg_data := l_msg_summary || l_msg_details;
623 else
624 x_msg_data := l_msg_summary;
625 end if;
626
627 --
628 -- Debug Statements
629 --
630 IF l_debug_on THEN
631 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_PROXY exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
632 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_PROXY');
633 END IF;
634 --
635 WHEN WSH_U_APPVER THEN
636 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_APPVER');
637 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
638 x_return_status := FND_API.G_RET_STS_ERROR;
639 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
640 if x_msg_count > 1 then
641 x_msg_data := l_msg_summary || l_msg_details;
642 else
643 x_msg_data := l_msg_summary;
644 end if;
645
646 --
647 -- Debug Statements
648 --
649 IF l_debug_on THEN
650 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_APPVER exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
651 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_APPVER');
652 END IF;
653 --
654 WHEN WSH_U_LICAGRE THEN
655 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_LICAGRE');
656 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
657 x_return_status := FND_API.G_RET_STS_ERROR;
658 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
659 if x_msg_count > 1 then
660 x_msg_data := l_msg_summary || l_msg_details;
661 else
662 x_msg_data := l_msg_summary;
663 end if;
664
665 --
666 -- Debug Statements
667 --
668 IF l_debug_on THEN
669 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_LICAGRE exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
670 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_LICAGRE');
671 END IF;
672 --
673 WHEN WSH_U_RESTYP THEN
674 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_RESTYP');
675 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
676 x_return_status := FND_API.G_RET_STS_ERROR;
677 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
678 if x_msg_count > 1 then
679 x_msg_data := l_msg_summary || l_msg_details;
680 else
681 x_msg_data := l_msg_summary;
682 end if;
683
684 --
685 -- Debug Statements
686 --
687 IF l_debug_on THEN
688 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_RESTYP exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
689 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_RESTYP');
690 END IF;
691 --
692 WHEN WSH_U_CSP THEN
693 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_CSP');
694 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
695 x_return_status := FND_API.G_RET_STS_ERROR;
696 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
697 if x_msg_count > 1 then
698 x_msg_data := l_msg_summary || l_msg_details;
699 else
700 x_msg_data := l_msg_summary;
701 end if;
702
703 --
704 -- Debug Statements
705 --
706 IF l_debug_on THEN
707 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_CSP exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
708 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_CSP');
709 END IF;
710 --
711 WHEN WSH_U_CITYORZIP THEN
712 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_INQNO ');
713 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
714 x_return_status := FND_API.G_RET_STS_ERROR;
715 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
716 if x_msg_count > 1 then
717 x_msg_data := l_msg_summary || l_msg_details;
718 else
719 x_msg_data := l_msg_summary;
720 end if;
721
722 --
723 -- Debug Statements
724 --
725 IF l_debug_on THEN
726 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_CITYORZIP exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
727 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_CITYORZIP');
728 END IF;
729 --
730 End of Commented for Carrier Services Integration with Shipping project Bug 16095594*/
731 WHEN FND_API.G_EXC_UNEXPECTED_ERROR
732 THEN
733 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
734 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
735 THEN
736 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
737 END IF;
738 FND_MSG_PUB.count_and_get ( p_count => x_msg_count, p_data => x_msg_data);
739 --
740 -- Debug Statements
741 --
742 IF l_debug_on
743 THEN
744 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_UNEXPECTED_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
745 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
746 END IF;
747 --
748 WHEN OTHERS THEN
749 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
750 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
751 THEN
752 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
753 END IF;
754 FND_MSG_PUB.count_and_get ( p_count => x_msg_count, p_data => x_msg_data);
755
756 --
757 -- Debug Statements
758 --
759 IF l_debug_on
760 THEN
761 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
762 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
763 END IF;
764 --
765 END CSP_Validate;
766
767
768 END WSH_U_CSPV;