Files
intermax_test/tomcat/webapps/bussiness2/core.jsp
2024-04-05 11:57:34 +09:00

140 lines
4.3 KiB
Plaintext
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page contentType="text/html;charset=euc-kr" %>
<%@ page import = "java.rmi.*,
javax.naming.*,
java.sql.*,
javax.sql.*,
java.io.*,
java.net.*,
java.util.*,
tmax.webt.*"
%>
<%
//TMAX
WebtConnection connection = null;
WebtBuffer tp_request = null;
WebtBuffer tp_response = null;
//FEP
URL url = null;
URLConnection urlConnection = null;
String sUrl = "http://10.10.52.10:8880/IMXtest/fep_receiver.jsp"; //FEP call
String sUrl_call_sucess_flag = sUrl + " URL Call succeeded";
//Properties pro = new Properties();
//pro.load(new FileInputStream("C:/smtest/jsp/core.properties"));
//String system_test_target=pro.getProperty("system.test.target");
String system_test_target="FEP";
int random_sleep_milisec = (int) (Math.random() * 13) + 12;
String flag = Integer.toString(random_sleep_milisec).substring(0,1);
//System.out.println("random_sleep_milisec: " + random_sleep_milisec);
//System.out.println("flag: " + flag);
if(flag.compareTo("1") == 0){
system_test_target = "FEP";
}else{
system_test_target = "TMAX";
}
//FEP Call
if(system_test_target.compareTo("FEP")==0){
try {
url = new URL(sUrl);
urlConnection = url.openConnection();
InputStream is = urlConnection.getInputStream();
/*
byte[] buf = new byte[1024];
int len = -1;
try {
while((len = is.read(buf, 0, buf.length)) != -1) {
System.out.write(buf, 0, len);
}
} catch(IOException e) {
e.printStackTrace();
}
*/
} catch(Exception e) {
e.printStackTrace();
sUrl_call_sucess_flag = sUrl + " URL Call failed";
}
}
else{ //TMAX Call
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Tmax<61><78> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
Random random = new Random();
String lStr_randum_value=Integer.toString(Math.abs(random.nextInt()));
int int_Value_length= lStr_randum_value.length();
if(int_Value_length > 10){
lStr_randum_value = lStr_randum_value.substring(0, 10);
}
else{
for(int i=0; i<10-int_Value_length; i++){
lStr_randum_value=lStr_randum_value+"0";
}
}
String guid=lStr_randum_value +"_" + System.currentTimeMillis();
String txcode="tp_txcode001";
String sndstr = "[Core -> tmax]tmax call......."+ guid +"................" + txcode ;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//[Core -> tmax]tmax call.......5974573420_1706087409995................tp_txcode
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
try{
connection = new WebtConnection("10.10.52.10", 8888);
WebtRemoteService service = new WebtRemoteService("TOUPPER", connection);
tp_request = service.createStringBuffer();
tp_request.setString(sndstr);
tp_response = service.tpcall(tp_request);
System.out.println("tmax request : " + tp_request.getString());
System.out.println("tmax response : " + tp_response.getString());
}catch (WebtIOException ioe){
System.out.print("webt connection closed");
ioe.printStackTrace();
}catch (WebtServiceFailException sfe){
System.out.print("tmax server ruturns TP_FAIL");
sfe.printStackTrace();
}catch (WebtServiceException se){
System.out.print("tmax service fail. tperrno = " + se.getTPErrorMessage());
se.printStackTrace();
}finally{
connection.close();
}
}
%>
<html>
<head>
</head>
<body>
<%
if(system_test_target.compareTo("FEP")==0){
%>
<p>URL Call<br>[<%=sUrl_call_sucess_flag%>]</p>
<%
}else{
%>
<p>TMAX WebT Call Request<br>[<%=tp_request.getString()%>]</p>
<p>TMAX WebT Call Response<br>[<%=tp_response.getString()%>]</p>
<%
}
%>
</body>
</html>