<?xml version='1.0' encoding='UTF-8'?>
<ROWSET tableName='xxx'>
<EXEC_SQL>
CREATE OR REPLACE PROCEDURE HTTP_REQ (
	 XURL		IN	VARCHAR2
	,XBASE		IN	VARCHAR2 := 'http://localhost:8823/gf/jsp/TYPEB1/'
	,XUSER		IN	VARCHAR2 := 'C00000'
	,XPASSWD	IN	VARCHAR2 := 'C00000'
)
IS
	-- XURL  := 'AndonTP316.jsp';
--	XBASE	VARCHAR2(1024) := 'http://localhost:8823/gf/jsp/TYPEB1/';

	REQ		UTL_HTTP.REQ;
	RESP	UTL_HTTP.RESP;
--	VAL		VARCHAR2(1024);
BEGIN
--	P_KEKKA := 2;
	IF SUBSTR(XURL,1,7) = 'http://' THEN
		REQ := UTL_HTTP.BEGIN_REQUEST( UTL_URL.ESCAPE( XURL ) );
	ELSE
		REQ := UTL_HTTP.BEGIN_REQUEST( UTL_URL.ESCAPE( XBASE || XURL ) );
	END IF;

	UTL_HTTP.SET_AUTHENTICATION( REQ, XUSER, XPASSWD );
	UTL_HTTP.SET_HEADER( REQ, 'USER-AGENT', 'MOZILLA/4.0' );
	RESP := UTL_HTTP.GET_RESPONSE( REQ );
--	LOOP
--		UTL_HTTP.READ_LINE( RESP, VAL, TRUE );
--		DBMS_OUTPUT.PUT_LINE( SUBSTR(VAL,1,255) );
--	END LOOP;

--	IF RESP.STATUS_CODE = UTL_HTTP.HTTP_OK THEN
--		P_KEKKA := 0;
--	ELSE
--		P_ERRMSGS := RESP.REASON_PHRASE ;
--	END IF;

	UTL_HTTP.END_RESPONSE( RESP );
--	UTL_HTTP.END_REQUEST( REQ );

EXCEPTION
	WHEN UTL_HTTP.END_OF_BODY THEN
		UTL_HTTP.END_RESPONSE( RESP );
END HTTP_REQ;
</EXEC_SQL>
</ROWSET>
