DBA Data[Home] [Help]

PACKAGE BODY: APPS.WSH_U_GTT

Source


1 PACKAGE BODY WSH_U_GTT AS
2 /* $Header: WSHUGTTB.pls 115.7 2002/11/12 02:00:01 nparikh ship $ */
3 
4 	-- standard global constants
5 	G_PKG_NAME CONSTANT VARCHAR2(30) 		:= 'WSH_U_GTT';
6 	p_message_type	CONSTANT VARCHAR2(1) 	:= 'E';
7 
8 
9 
10 
11 
12 
13 
14 -- -------------------------------------------------------------------
15 -- Start of comments
16 -- API name			: Time_In_Transit
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 Time_In_Transit (
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_OriginNumber					IN		VARCHAR2,
36 		p_DestinationNumber			IN		VARCHAR2,
37 		x_TimeInTransit_out		  OUT NOCOPY 		TimeInTransitOutRec
38 
39 ) IS
40 
41 		-- standard version infermation
42 		l_api_version	CONSTANT	NUMBER		:= 1.0;
43 		l_api_name	CONSTANT	VARCHAR2(30)   := 'Time_In_Tansit';
44 
45 		-- standard variables
46 		l_return_status	VARCHAR2(1)			:= FND_API.G_RET_STS_SUCCESS;
47 		l_msg_count		NUMBER					:= 0;
48 		l_msg_data		VARCHAR2(2000) 		:= NULL;
49 		l_msg_summary		VARCHAR2(2000) 		:= NULL;
50 		l_msg_details		VARCHAR2(4000) 		:= NULL;
51 
52 
53 		-- L_UPS_URL VARCHAR2(200) := 'http://wwwapps.ups.com/transit/timetran.cgi';
54 		L_UPS_URL VARCHAR2(1000) := NULL;
55 		L_INTERNET_PROXY VARCHAR2(1000) := NULL;
56 
57 		l_boundary_string_start		NUMBER  := 0;
58 		l_boundary_string_end			NUMBER  := 0;
59 		l_boundary_string				VARCHAR2(100)		 := NULL;
60 
61 		L_Content_Str_Len				NUMBER	:= 0;
62 
63 		L_INPUT_STR VARCHAR2(2000);
64 		L_OUTPUT_STR VARCHAR2(10000);
65 		l_output_data  utl_http.html_pieces;
66 
67 		L_GTT_Message VARCHAR2(500);
68 
69 		L_Content_Type VARCHAR2(200);
70 
71 		L_Locate_boundary NUMBER := 1;
72 		L_Locate_Str_Len  NUMBER := 1;
73 		L_Locate_Str_Len_End NUMBER := 0;
74 		L_Locate_Content  NUMBER :=1;
75 		L_Locate_boundary_End NUMBER := 1;
76 		L_Locate_Begin   NUMBER := 1;
77 		L_Token_Start NUMBER := 1;
78 		L_Token_End NUMBER := 0;
79 		l_find_error NUMBER := 0;
80 
81 		-- this is used to print the debug message only
82 
83 		WSH_U_INPUT_PARAMETER 		exception;
84 		WSH_U_CAR_URL				exception;
85 		WSH_U_PROXY				exception;
86 		WSH_U_APPVER				exception;
87 		WSH_U_LICAGRE				exception;
88 		WSH_U_RESTYP				exception;
89 		WSH_U_ORIGINNUM			exception;
90 		WSH_U_DESTINATIONNUM		exception;
91 		WSH_U_NO_HOST			exception;
92 		REQUEST_FAILED			exception;
93 		INIT_FAILED			exception;
94 
95 
96 --
97 l_debug_on BOOLEAN;
98 --
99 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'TIME_IN_TRANSIT';
100 --
101 BEGIN
102 
103 
104 		-- Standard call to check for call compatibility.
105 		--
106 		-- Debug Statements
107 		--
108 		--
109 		l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
110 		--
111 		IF l_debug_on IS NULL
112 		THEN
113 		    l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
114 		END IF;
115 		--
116 		IF l_debug_on THEN
117 		    WSH_DEBUG_SV.push(l_module_name);
118 		    --
119 		    WSH_DEBUG_SV.log(l_module_name,'P_API_VERSION',P_API_VERSION);
120 		    WSH_DEBUG_SV.log(l_module_name,'P_INIT_MSG_LIST',P_INIT_MSG_LIST);
121 		    WSH_DEBUG_SV.log(l_module_name,'P_APPVERSION',P_APPVERSION);
122 		    WSH_DEBUG_SV.log(l_module_name,'P_ACCEPTLICENSEAGREEMENT',P_ACCEPTLICENSEAGREEMENT);
123 		    WSH_DEBUG_SV.log(l_module_name,'P_RESPONSETYPE',P_RESPONSETYPE);
124 		    WSH_DEBUG_SV.log(l_module_name,'P_ORIGINNUMBER',P_ORIGINNUMBER);
125 		    WSH_DEBUG_SV.log(l_module_name,'P_DESTINATIONNUMBER',P_DESTINATIONNUMBER);
126 		END IF;
127 		--
128 		IF NOT FND_API.compatible_api_call(	l_api_version,
129  										p_api_version,
130 										l_api_name,
131 										G_PKG_NAME) THEN
132 	 		RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
133  		END IF;
134 
135 		-- Check p_init_msg_list
136 		IF FND_API.to_boolean(p_init_msg_list)	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 
143 		x_msg_count 	:= 0;
144 		x_msg_data 	:= NULL;
145 
146 		-- program specific logic begins here
147 
148 
149 
150 		--
151 		-- Debug Statements
152 		--
153 		IF l_debug_on THEN
154 		    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.GET_CARRIER_API_URL',WSH_DEBUG_SV.C_PROC_LEVEL);
155 		END IF;
156 		--
157 		L_UPS_URL := WSH_U_UTIL.Get_Carrier_API_URL(
158 	 						p_api_version		=> 1.0,
159 							p_init_msg_list	=> FND_API.G_TRUE,
160 							x_return_status	=> l_return_status,
161 							x_msg_count       => l_msg_count,
162 							x_msg_data        => l_msg_data,
163 							p_Carrier_Name		=> 'UPS',
164 							p_API_Name		   => 'TIME_IN_TRANSIT');
165 		if l_return_status <> FND_API.G_RET_STS_SUCCESS then
166 				raise WSH_U_CAR_URL;
167 		end if;
168 
169 
170 		L_INPUT_STR := L_UPS_URL || '?';
171 
172 		-- ---------------------------------------------------------------
173 		-- UPS standard parameters: AppVersion
174 		--                          AcceptLicenseAgreement
175 		--	     							 ResponseType
176 		-- ---------------------------------------------------------------
177 
178 		-- AppVersion ---------------------------------------------------------
179       if( p_AppVersion IS NULL) then
180 			raise WSH_U_APPVER;
181 			-- p_AppVersion := '1.0';
182       end if;
183 		L_INPUT_STR := L_INPUT_STR || 'AppVersion' ||'='|| p_AppVersion;
184 
185 		-- AcceptLicenseAgreement ---------------------------------------------
186       if( p_AcceptLicenseAgreement IS NULL) then
187 			raise WSH_U_LICAGRE;
188 			-- p_AcceptLicenseAgreement := 'YES';
189       end if;
190 		L_INPUT_STR := L_INPUT_STR || '&' ||'AcceptUPSLicenseAgreement'||'=' || p_AcceptLicenseAgreement;
191 
192 		-- ResponseType --------------------------------------------------------
193       if( p_ResponseType IS NULL) then
194 			raise WSH_U_RESTYP;
195 			-- p_ResponseType := 'application/x-ups-timetran';
196       end if;
197       L_INPUT_STR := L_INPUT_STR || '&' || 'ResponseType' ||'='|| p_ResponseType;
198 
199 
200 		-- --------------------------------------------------------------------
201 		-- Origin Postal Code is required
202 		-- --------------------------------------------------------------------
203 		if (p_OriginNumber IS NULL) then
204 				raise WSH_U_ORIGINNUM;
205 	   else
206 			L_INPUT_STR := L_INPUT_STR || '&' || 'OriginNumber' ||'='|| p_OriginNumber;
207 		end if;
208 
209 		-- ----------------------------------------------------------------
210 		-- Destination Postal Code is required
211 		-- ----------------------------------------------------------------
212 		if (p_DestinationNumber IS NULL) then
213 				raise WSH_U_DESTINATIONNUM;
214 	   else
215 			L_INPUT_STR := L_INPUT_STR || '&' || 'DestinationNumber' ||'='|| p_DestinationNumber;
216 		end if;
217 
218 		L_INPUT_STR := REPLACE(L_INPUT_STR, ' ', '+');
219 
220 			 -- DBMS_OUTPUT.PUT_LINE('========== request begin =========');
221 			 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,0,50));
222 			 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,51,50));
223 			 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,101,50));
224 			 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,151,50));
225 			 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,201,50));
226 			 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,251,50));
227 			 -- DBMS_OUTPUT.PUT_LINE('========== request end =========');
228 
229 		-- clear variables before calling subroutine
230 		l_return_status	:= FND_API.G_RET_STS_SUCCESS;
231 		l_msg_count			:= 0;
232 		l_msg_data			:= NULL;
233 
234 
235 	 	-- get proxy server URL
236 		--
237 		-- Debug Statements
238 		--
239 		IF l_debug_on THEN
240 		    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.GET_PROXY',WSH_DEBUG_SV.C_PROC_LEVEL);
241 		END IF;
242 		--
243 		L_INTERNET_PROXY := WSH_U_UTIL.Get_PROXY(
244 	 					p_api_version			=> 1.0,
245 						p_init_msg_list		=> FND_API.G_TRUE,
246 						x_return_status		=> l_return_status,
247 						x_msg_count				=> l_msg_count,
248 						x_msg_data				=> l_msg_data);
249 
250 		if l_return_status <> FND_API.G_RET_STS_SUCCESS then
251 				raise WSH_U_PROXY;
252 		end if;
253 		-- send request to UPS site
254 		if L_INTERNET_PROXY is not NULL then
255 	   		l_output_data := utl_http.request_pieces(L_INPUT_STR,100,L_INTERNET_PROXY);
256 		else
257 	   		l_output_data := utl_http.request_pieces(L_INPUT_STR,100);
258 		end if;
259 		-- when no response is received from a request to a given URL
260 		-- then a formatted HTML error message may be returned, it contains the
261 		-- following error message
262 		l_find_error := INSTR(l_output_data(1), 'Can''t locate remote host');
263 		if l_find_error <> 0 then
264 		   raise WSH_U_NO_HOST;
265 		end if;
266 
267 		-- It is only good for up to 100 iteration else it will fail.
268 		-- DBMS_OUTPUT.PUT_LINE('======= result begin =============');
269 
270 		FOR i in 1 .. l_output_data.count LOOP
271 				L_OUTPUT_STR := L_OUTPUT_STR || l_output_data(i);
272 					 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1, 250));
273 					 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 251, 250));
274 					 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 501, 250));
275 					 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 751, 250));
276 					 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1001, 250));
277 					 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1251, 250));
278 					 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1501, 250));
279 					 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1751, 250));
280 		END LOOP;
281 
282 		-- DBMS_OUTPUT.PUT_LINE('========== result end ===========');
283     	l_boundary_string_start		:= INSTR(L_OUTPUT_STR, 'boundary=', 1 , 1);
284 		if l_boundary_string_start <> 0 then
285     		l_boundary_string_start		:= l_boundary_string_start + 9;
286 			-- l_boundary_string_end	:= INSTR(L_OUTPUT_STR, '--', l_boundary_string_start,1);
287 			l_boundary_string_end		:= INSTR(L_OUTPUT_STR, FND_GLOBAL.LOCAL_CHR(13), l_boundary_string_start,1);
288 			l_boundary_string				:= SUBSTR(L_OUTPUT_STR,
289 													l_boundary_string_start ,
290 	 												l_boundary_string_end - l_boundary_string_start);
291 		else
292 
293 			l_boundary_string		:= 'UPSBOUNDARY';
294 		end if;
295 
296 		-- set default boundary string if the return message does not specify
297 		l_boundary_string := '--' || l_boundary_string;
298 		-- DBMS_OUTPUT.PUT_LINE('Boundary String:'|| l_boundary_string);
299 
300 
301 
302 		LOOP
303 
304  			L_Locate_boundary :=INSTR(L_OUTPUT_STR, l_boundary_string ,L_Locate_boundary,1);
305 			L_Locate_Content := INSTR(L_OUTPUT_STR,'Content-type',L_Locate_boundary,1);
306 			-- DBMS_OUTPUT.PUT_LINE('LOCATE CONTENT IS************'||to_char(L_Locate_Content));
307 			L_Locate_Str_Len  := INSTR(L_OUTPUT_STR, 'Content-length',L_Locate_boundary,1);
308 			-- DBMS_OUTPUT.PUT_LINE('LOCATE STR IS************'||to_char(L_Locate_Str_Len));
309     		L_Locate_Begin   := INSTR(L_OUTPUT_STR,'UPSOnLine',L_Locate_boundary,1);
310 			-- DBMS_OUTPUT.PUT_LINE('LOCATE BEGIN IS************'||to_char(L_Locate_Begin));
311 			L_Locate_boundary_End := INSTR(L_OUTPUT_STR, l_boundary_string ,L_Locate_boundary,2);
312 			-- DBMS_OUTPUT.PUT_LINE('LOCATE boundary END************'||to_char(L_Locate_boundary_End));
313 
314 			IF(L_Locate_boundary_End > L_Locate_Begin) THEN
315 
316 				-- Get Content-length
317 				L_Locate_Str_Len_End := INSTR(L_OUTPUT_STR, FND_GLOBAL.LOCAL_CHR(13), L_Locate_Str_Len, 1);
318 				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));
319 
320 				-- DBMS_OUTPUT.PUT_LINE('CONTENT STR LENGTH IS ***********'||to_char(L_Content_Str_Len));
321 				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/'))));
322 
323 				L_GTT_Message := SUBSTR(L_OUTPUT_STR, L_Locate_Begin, L_Content_Str_Len);
324 				-- DBMS_OUTPUT.put_line('Message Is:'||L_GTT_Message);
325 				-- DBMS_OUTPUT.PUT_LINE('CONTENT_TYPE IS ************'||L_Content_Type||'*********');
326 
327 				if(SUBSTR(L_Content_Type,1,LENGTH('x-ups-timetran')) = 'x-ups-timetran' or
328 				 		SUBSTR(L_Content_Type,1,LENGTH('x-ups-error')) = 'x-ups-error')
329 				then
330 					-- DBMS_OUTPUT.PUT_LINE('===<begin> ======');
331 					L_Token_Start := 0;
332 					L_Token_End := 0;
333 
334 
335 					--
336 					-- Debug Statements
337 					--
338 					IF l_debug_on THEN
339 					    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
340 					END IF;
341 					--
342 					x_TimeInTransit_out.UPSOnLine :=
343 							WSH_U_UTIL.Calculate_Token(L_GTT_Message,L_Token_Start,L_Token_End);
344 
345 					--
346 					-- Debug Statements
347 					--
348 					IF l_debug_on THEN
349 					    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
350 					END IF;
351 					--
352 					x_TimeInTransit_out.AppVersion :=
353 							WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
354 
355 					--
356 					-- Debug Statements
357 					--
358 					IF l_debug_on THEN
359 					    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
360 					END IF;
361 					--
362 					x_TimeInTransit_out.ReturnCode :=
363 							TO_NUMBER(WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End));
364 					-- DBMS_OUTPUT.PUT_LINE('Return Code: ' || TO_CHAR(x_TimeInTransit_out.ReturnCode));
365 
366 					--
367 					-- Debug Statements
368 					--
369 					IF l_debug_on THEN
370 					    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
371 					END IF;
372 					--
373 					x_TimeInTransit_out.MessageText :=
374 							WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
375 
376 					x_TimeInTransit_out.MessageNumber :=
377 							TO_NUMBER(SUBSTR(x_TimeInTransit_out.MessageText,1,4));
378 					-- DBMS_OUTPUT.PUT_LINE('MessageNumber: ' || TO_CHAR(x_TimeInTransit_out.MessageNumber));
379 
380 					x_TimeInTransit_out.MessageText :=
381 							SUBSTR(x_TimeInTransit_out.MessageText,5,(LENGTH(x_TimeInTransit_out.MessageText)-4));
382 					-- DBMS_OUTPUT.PUT_LINE('MessageText: ' || x_TimeInTransit_out.MessageText);
383 
384 					if (x_TimeInTransit_out.ReturnCode = 0) then
385 
386 						--
387 						-- Debug Statements
388 						--
389 						IF l_debug_on THEN
390 						    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
391 						END IF;
392 						--
393 						x_TimeInTransit_out.TransitTime :=
394 								WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
395 
396 						--
397 						-- Debug Statements
398 						--
399 						IF l_debug_on THEN
400 						    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
401 						END IF;
402 						--
403 						x_TimeInTransit_out.OriginCity :=
404 								WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
405 
406 						--
407 						-- Debug Statements
408 						--
409 						IF l_debug_on THEN
410 						    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
411 						END IF;
412 						--
413 						x_TimeInTransit_out.OriginStateProv :=
414 								WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
415 
416 						--
417 						-- Debug Statements
418 						--
419 						IF l_debug_on THEN
420 						    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
421 						END IF;
422 						--
423 						x_TimeInTransit_out.DestinationCity :=
424 								WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
425 
426 						--
427 						-- Debug Statements
428 						--
429 						IF l_debug_on THEN
430 						    WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
431 						END IF;
432 						--
433 						x_TimeInTransit_out.DestinationStateProv :=
434 								WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
435 					else
436 						x_TimeInTransit_out.TransitTime		:= NULL;
437 						x_TimeInTransit_out.OriginCity		:= NULL;
438 						x_TimeInTransit_out.OriginStateProv := NULL;
439 						x_TimeInTransit_out.DestinationCity := NULL;
440 						x_TimeInTransit_out.DestinationStateProv := NULL;
441 					end if;
442 					-- DBMS_OUTPUT.PUT_LINE('===<end> === application/x-ups-timetran ===');
443 				end if;
444 
445 
446 		END IF;
447 
448 		-- advance to next UPSBOUNDARYUPS section
449 		L_Locate_boundary := L_Locate_boundary_End;
450 
451  		EXIT WHEN L_Locate_Begin = 0;
452 
453     END LOOP;
454 
455 
456 
457 
458 --
459 -- Debug Statements
460 --
461 IF l_debug_on THEN
462     WSH_DEBUG_SV.pop(l_module_name);
463 END IF;
464 --
465 EXCEPTION
466 
467 		WHEN WSH_U_CAR_URL THEN
468 		   FND_MESSAGE.SET_NAME('WSH', 'WSH_U_CAR_URL');
469 			WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
470 			x_return_status := FND_API.G_RET_STS_ERROR;
471 			WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
472 			if x_msg_count > 1 then
473 				x_msg_data := l_msg_summary || l_msg_details;
474 			else
475 				x_msg_data := l_msg_summary;
476 		   end if;
477 
478 			--
479 			-- Debug Statements
480 			--
481 			IF l_debug_on THEN
482 			    WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_CAR_URL exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
483 			    WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_CAR_URL');
484 			END IF;
485 			--
486 		WHEN WSH_U_PROXY THEN
487 			FND_MESSAGE.SET_NAME('WSH', 'WSH_U_PROXY');
488 			WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
489 			x_return_status := FND_API.G_RET_STS_ERROR;
490 			WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
491 			if x_msg_count > 1 then
492 				x_msg_data := l_msg_summary || l_msg_details;
493 			else
494 				x_msg_data := l_msg_summary;
495 		   end if;
496 
497 	  	-- this exception is produced by UTL_HTTP.REQUEST_PIECES
498 	  	-- The http call fails(for example, bacause of failure of the HTTP
499 	  	-- daemon, or bacause the argument to REQUEST_PIECES cannot be interpreted
500 	  	-- as a URL because it is NULL or has non-HTTP syntax)
501 	  	--
502 	  	-- Debug Statements
503 	  	--
504 	  	IF l_debug_on THEN
505 	  	    WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_PROXY exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
506 	  	    WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_PROXY');
507 	  	END IF;
508 	  	--
509 		WHEN REQUEST_FAILED THEN
510 			FND_MESSAGE.SET_NAME('WSH', 'WSH_U_REQ_FAILED');
511 			WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
512 			x_return_status := FND_API.G_RET_STS_ERROR;
513 			WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
514 			if x_msg_count > 1 then
515 				x_msg_data := l_msg_summary || l_msg_details;
516 			else
517 				x_msg_data := l_msg_summary;
518 		   	end if;
519 
520 	  	-- this exception is produced by UTL_HTTP.REQUEST_PIECES
521 	  	-- Initialization of the HTTP callout subsystem failed
522 		-- for invironmental reasons such as lack of available memory
523 		--
524 		-- Debug Statements
525 		--
526 		IF l_debug_on THEN
527 		    WSH_DEBUG_SV.logmsg(l_module_name,'REQUEST_FAILED exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
528 		    WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:REQUEST_FAILED');
529 		END IF;
530 		--
531 		WHEN INIT_FAILED THEN
532 			FND_MESSAGE.SET_NAME('WSH', 'WSH_U_INIT_FAILED');
533 			WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
534 			x_return_status := FND_API.G_RET_STS_ERROR;
535 			WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
536 			if x_msg_count > 1 then
537 				x_msg_data := l_msg_summary || l_msg_details;
538 			else
539 				x_msg_data := l_msg_summary;
540 		   end if;
541 
542 		--
543 		-- Debug Statements
544 		--
545 		IF l_debug_on THEN
546 		    WSH_DEBUG_SV.logmsg(l_module_name,'INIT_FAILED exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
547 		    WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INIT_FAILED');
548 		END IF;
549 		--
550 		WHEN WSH_U_NO_HOST THEN
551 			FND_MESSAGE.SET_NAME('WSH', 'WSH_U_NO_HOST');
552 			WSH_UTIL_CORE.ADD_MESSAGE('E');
553 			x_return_status := FND_API.G_RET_STS_ERROR;
554 			WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
555 			if x_msg_count > 1 then
556 				x_msg_data := l_msg_summary || l_msg_details;
557 			else
558 				x_msg_data := l_msg_summary;
559 		   end if;
560 
561 
562 			--
563 			-- Debug Statements
564 			--
565 			IF l_debug_on THEN
566 			    WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_NO_HOST exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
567 			    WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_NO_HOST');
568 			END IF;
569 			--
570 		WHEN  WSH_U_APPVER THEN
571 			FND_MESSAGE.SET_NAME('WSH', 'WSH_U_APPVER');
572 			WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
573 			x_return_status := FND_API.G_RET_STS_ERROR;
574 			WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
575 			if x_msg_count > 1 then
576 				x_msg_data := l_msg_summary || l_msg_details;
577 			else
578 				x_msg_data := l_msg_summary;
579 		   end if;
580 
581 			--
582 			-- Debug Statements
583 			--
584 			IF l_debug_on THEN
585 			    WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_APPVER exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
586 			    WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_APPVER');
587 			END IF;
588 			--
589 		WHEN  WSH_U_LICAGRE THEN
590 			FND_MESSAGE.SET_NAME('WSH', 'WSH_U_LICAGRE');
591 			WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
592 			x_return_status := FND_API.G_RET_STS_ERROR;
593 
594 
595 			--
596 			-- Debug Statements
597 			--
598 			IF l_debug_on THEN
599 			    WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_LICAGRE exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
600 			    WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_LICAGRE');
601 			END IF;
602 			--
603 		WHEN  WSH_U_RESTYP THEN
604 			FND_MESSAGE.SET_NAME('WSH', 'WSH_U_RESTYP');
605 			WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
606 			x_return_status := FND_API.G_RET_STS_ERROR;
607 			WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
608 			if x_msg_count > 1 then
609 				x_msg_data := l_msg_summary || l_msg_details;
610 			else
611 				x_msg_data := l_msg_summary;
612 		   end if;
613 
614 		--
615 		-- Debug Statements
616 		--
617 		IF l_debug_on THEN
618 		    WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_RESTYP exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
619 		    WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_RESTYP');
620 		END IF;
621 		--
622 		WHEN WSH_U_ORIGINNUM THEN
623 			FND_MESSAGE.SET_NAME('WSH', 'WSH_U_ORIGINNUM');
624 			WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
625 			x_return_status := FND_API.G_RET_STS_ERROR;
626 			WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
627 			if x_msg_count > 1 then
628 				x_msg_data := l_msg_summary || l_msg_details;
629 			else
630 				x_msg_data := l_msg_summary;
631 		   end if;
632 
633 --
634 -- Debug Statements
635 --
636 IF l_debug_on THEN
637     WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_ORIGINNUM exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
638     WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_ORIGINNUM');
639 END IF;
640 --
641 		WHEN 	WSH_U_DESTINATIONNUM THEN
642 			FND_MESSAGE.SET_NAME('WSH', 'WSH_U_DESTINATIONNUM');
643 			WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
644 			x_return_status := FND_API.G_RET_STS_ERROR;
645 						WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
646 			if x_msg_count > 1 then
647 				x_msg_data := l_msg_summary || l_msg_details;
648 			else
649 				x_msg_data := l_msg_summary;
650 		   end if;
651 
652 
653 			--
654 			-- Debug Statements
655 			--
656 			IF l_debug_on THEN
657 			    WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_DESTINATIONNUM exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
658 			    WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_DESTINATIONNUM');
659 			END IF;
660 			--
661 		WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
662 			x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
663 			IF	FND_MSG_PUB.check_msg_level
664 		        (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
665 			THEN
666 					FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
667 			END IF;
668 			FND_MSG_PUB.count_and_get ( p_count => x_msg_count, p_data => x_msg_data);
669 
670 --
671 -- Debug Statements
672 --
673 IF l_debug_on THEN
674     WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_UNEXPECTED_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
675     WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
676 END IF;
677 --
678 		WHEN OTHERS THEN
679 			x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
680 			IF	FND_MSG_PUB.check_msg_level
681 		        (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
682 			THEN
683 					FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
684 			END IF;
685 			FND_MSG_PUB.count_and_get ( p_count => x_msg_count, p_data => x_msg_data);
686 
687 			--
688 			-- Debug Statements
689 			--
690 			IF l_debug_on THEN
691 			    WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
692 			    WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
693 			END IF;
694 			--
695 END Time_In_Transit;
696 
697 
698 END WSH_U_GTT;