List of usage examples for org.bouncycastle.jce.provider BouncyCastleProvider BouncyCastleProvider
public BouncyCastleProvider()
From source file:NaverShopnCancelReturn.java
/** * // www .j a va 2 s . c o m * @param serviceName * @param operationName * @throws Exception */ public void encryptInit(String serviceName, String operationName) throws Exception { this.setServiceName(serviceName); this.setOperationName(operationName); Security.addProvider(new BouncyCastleProvider()); this.setTimestamp(SimpleCryptLib.getTimestamp()); this.setData(this.getTimestamp() + this.getServiceName() + this.getOperationName()); //generateSign this.setSignature(SimpleCryptLib.generateSign(this.getData(), this.getSecretKey())); //generateKey this.setEncryptKey(SimpleCryptLib.generateKey(this.getTimestamp(), this.getSecretKey())); //encrypt this.setEncryptedData(SimpleCryptLib.encrypt(this.getEncryptKey(), this.getPassword().getBytes("UTF-8"))); this.setDecryptedData( new String(SimpleCryptLib.decrypt(this.getEncryptKey(), this.getEncryptedData()), "UTF-8")); this.setHashedData(SimpleCryptLib.sha256(this.getPassword())); System.out.println("accessLicense : [" + this.getAccessLicense() + "]"); System.out.println("secretKey : [" + this.getSecretKey() + "]"); System.out.println("serviceName : [" + this.getServiceName() + "]"); System.out.println("operationName : [" + this.getOperationName() + "]"); System.out.println("timestamp : [" + this.getTimestamp() + "]"); System.out.println("signature : [" + this.getSignature() + "]"); System.out.println("encryptKey : [" + new String(Hex.encode(this.getEncryptKey())) + "]"); System.out.println("encryptedData : [" + this.getEncryptedData() + "]"); System.out.println("decryptedData : [" + this.getDecryptedData() + "]"); System.out.println("sha256Data : [" + this.getHashedData() + "]"); System.out.println("[==============================================================]"); System.out.println("[==============================================================]"); System.out.println("[==================encryptInit()===============================]"); System.out.println("[==================encryptInit()===============================]"); System.out.println("[==============================================================]"); System.out.println("[==============================================================]"); }
From source file:NaverCheckOutGetOrder.java
private String run2(String OrderID) { String response_type = ""; try {/* w w w. j ava2 s . co m*/ SimpleCryptLib SimpleCryptLib = new SimpleCryptLib(); Security.addProvider(new BouncyCastleProvider()); String accessLicense = "0100010000a3a4a4365b74db9433a0971c8f85f2de07661a6338b6bb9c2155a2fc892d4ff5"; String secretKey = "AQABAADe1F8bpQsO4ORdqfzpIj2Fl5YwstWww9JGEUNLxU78Dg=="; String serviceName = "MallService2"; String id = "wjsgnsvy"; String password = "jhp1229"; String timestamp = null; String signature = null; String data = null; byte[] encryptKey = null; String encryptedData = null; String decryptedData = null; String hashedData = null; String operationName = "PlaceOrder"; //timestamp create timestamp = SimpleCryptLib.getTimestamp(); //generateSign data = timestamp + serviceName + operationName; signature = SimpleCryptLib.generateSign(data, secretKey); //generateKey encryptKey = SimpleCryptLib.generateKey(timestamp, secretKey); //encrypt encryptedData = SimpleCryptLib.encrypt(encryptKey, password.getBytes("UTF-8")); //decrypt decryptedData = new String(SimpleCryptLib.decrypt(encryptKey, encryptedData), "UTF-8"); //sha256 hashedData = SimpleCryptLib.sha256(password); NaverCheckOutGetOrder NaverCheckOutGetOrder = new NaverCheckOutGetOrder(); String orderlist = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:mall=\"http://mall.checkout.platform.nhncorp.com/\" xmlns:base=\"http://base.checkout.platform.nhncorp.com/\">" + "<soapenv:Header/>" + "<soapenv:Body>" + "<mall:PlaceOrderRequest>" + "<base:RequestID>?</base:RequestID>" + "<base:AccessCredentials>" + "<base:AccessLicense>" + accessLicense + "</base:AccessLicense>" + "<base:Timestamp>" + timestamp + "</base:Timestamp>" + "<base:Signature>" + signature + "</base:Signature>" + "</base:AccessCredentials>" + "<base:DetailLevel>Full</base:DetailLevel>" + "<base:Version>2.0</base:Version>" + "<base:OrderID>" + OrderID + "</base:OrderID>" + "</mall:PlaceOrderRequest>" + "</soapenv:Body>" + "</soapenv:Envelope>"; System.out.println("OrderID:**********" + OrderID + "**********"); //Create socket //String hostname = "ec.api.naver.com"; String hostname = "api.naver.com"; int port = 80; InetAddress addr = InetAddress.getByName(hostname); Socket sock = new Socket(addr, port); //Send header String path = "/Checkout/MallService2"; BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream(), "UTF-8")); // You can use "UTF8" for compatibility with the Microsoft virtual machine. wr.write("POST " + path + " HTTP/1.0 \r\n"); wr.write("Host: api.naver.com \r\n"); wr.write("Content-Length: " + orderlist.length() + "\r\n"); wr.write("Content-Type: text/xml; charset=\"UTF-8\"\r\n"); wr.write("SOAPAction: \"http://api.naver.com/Checkout/MallService2\" \r\n"); wr.write("\r\n"); //Send data wr.write(orderlist); System.out.println("orderlist:" + orderlist); wr.flush(); // Response BufferedReader rd = new BufferedReader(new InputStreamReader(sock.getInputStream(), "UTF-8")); String line = ""; String line_total = ""; String tmp = ""; String tmp2 = ""; String newxml = ""; while ((line = rd.readLine()) != null) { if (line.startsWith("<?xml")) { line_total = line_total + line; } } line_total = line_total.replaceAll("n1:", ""); System.out.println(line_total); //xml2 InputStream in = new ByteArrayInputStream(line_total.getBytes("UTF-8")); SAXBuilder builder = new SAXBuilder(); Document document = builder.build(in); Element element = document.getRootElement(); List envel_list = element.getChildren(); List body_list = null; List body_list1 = null; List result_list = null; List result_list1 = null; List result_list2 = null; List result_list3 = null; List result_list4 = null; List result_list5 = null; List info_list = null; List contr_group_list = null; List contr_info_list = null; PreparedStatement pstmt = null; ResultSet rs = null; CallableStatement cStmt = null; System.out.println("DBconnect"); //conn.setAutoCommit(false); long UNIT_ID = 0; long cnt = 0; long interface_seq = 0; long DEL_QTY = 0; long ITEM_ID = 0; String ITEM_NAME = null; System.out.println("envel_list.size:" + envel_list.size()); Element envel_el = (Element) envel_list.get(0); body_list = envel_el.getChildren(); System.out.println("+++++++el.getName() : " + envel_el.getChildren()); System.out.println("body_list.size:" + body_list.size()); Element body_el = (Element) body_list.get(0); response_type = body_el.getChildText("ResponseType"); System.out.println("response_type:" + response_type); String Error = body_el.getChildText("Error"); System.out.println("Error:" + Error); String QuotaStatus = body_el.getChildText("QuotaStatus"); System.out.println("QuotaStatus:" + QuotaStatus); } catch (Exception e) { System.out.println("run() : " + e.getMessage()); } finally { } System.out.println("FINAL response_type:" + response_type); return response_type; }
From source file:NaverCheckOutGetOrder.java
public String run() { String response_type = "FALSE"; try {// w ww . j av a2 s. co m SimpleCryptLib SimpleCryptLib = new SimpleCryptLib(); Security.addProvider(new BouncyCastleProvider()); // String accessLicense = "0100010000ccc831f99d7d2523deadf954c8459d6b671b20006e221f64c45dea503be632be"; // String secretKey = "AQABAACDZOhE97kLH8iavhKiQCHbCGlfQfqCSGRxDlAV6uddcg=="; String accessLicense = "0100010000a3a4a4365b74db9433a0971c8f85f2de07661a6338b6bb9c2155a2fc892d4ff5"; String secretKey = "AQABAADe1F8bpQsO4ORdqfzpIj2Fl5YwstWww9JGEUNLxU78Dg=="; String serviceName = "MallService2"; String id = "wjsgnsvy"; String password = "jhp1229"; String timestamp = null; String signature = null; String data = null; byte[] encryptKey = null; String encryptedData = null; String decryptedData = null; String hashedData = null; String operationName = "GetPaidOrderList"; //String orderID = "200087036"; //timestamp create timestamp = SimpleCryptLib.getTimestamp(); System.out.println("timestamp:" + timestamp); //generateSign data = timestamp + serviceName + operationName; signature = SimpleCryptLib.generateSign(data, secretKey); //generateKey encryptKey = SimpleCryptLib.generateKey(timestamp, secretKey); //encrypt encryptedData = SimpleCryptLib.encrypt(encryptKey, password.getBytes("UTF-8")); //decrypt decryptedData = new String(SimpleCryptLib.decrypt(encryptKey, encryptedData), "UTF-8"); //sha256 hashedData = SimpleCryptLib.sha256(password); NaverCheckOutGetOrder NaverCheckOutGetOrder = new NaverCheckOutGetOrder(); System.out.println("NaverCheckOutGetOrder.getYesterday():" + NaverCheckOutGetOrder.getYesterday()); System.out.println("NaverCheckOutGetOrder.getYesterday():" + NaverCheckOutGetOrder.getToday()); System.out.println("accessLicense : [" + accessLicense + "]"); System.out.println("secretKey : [" + secretKey + "]"); System.out.println("serviceName : [" + serviceName + "]"); System.out.println("operationName : [" + operationName + "]"); System.out.println("timestamp : [" + timestamp + "]"); System.out.println("signature : [" + signature + "]"); System.out.println("encryptKey : [" + new String(Hex.encode(encryptKey)) + "]"); System.out.println("encryptedData : [" + encryptedData + "]"); System.out.println("decryptedData : [" + decryptedData + "]"); System.out.println("sha256Data : [" + hashedData + "]"); /*String xmldata = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:mall=\"http://mall.checkout.platform.nhncorp.com/\" xmlns:base=\"http://base.checkout.platform.nhncorp.com/\">" + "<soapenv:Header/>" + "<soapenv:Body>" + "<mall:GetOrderInfoRequest>" + "<base:RequestID>?</base:RequestID>" + "<base:AccessCredentials>" + "<base:AccessLicense>"+ accessLicense +"</base:AccessLicense>" + "<base:Timestamp>"+ timestamp +"</base:Timestamp>" + "<base:Signature>"+ signature +"</base:Signature>" + "</base:AccessCredentials>" + "<base:DetailLevel>Full</base:DetailLevel>" + //<!-- value Full, Compact ) "<base:Version>2.0</base:Version>" + "<OrderID>"+ orderID +"</OrderID>" + "</mall:GetOrderInfoRequest>" + "</soapenv:Body>" + "</soapenv:Envelope>";*/ System.out.println("NaverCheckOutGetOrder.getYesterday():" + NaverCheckOutGetOrder.getYesterday()); System.out.println("NaverCheckOutGetOrder.getToday():" + NaverCheckOutGetOrder.getToday()); String orderlist = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:mall=\"http://mall.checkout.platform.nhncorp.com/\" xmlns:base=\"http://base.checkout.platform.nhncorp.com/\">" + "<soapenv:Header/>" + "<soapenv:Body>" + "<mall:GetPaidOrderListRequest>" + "<base:RequestID>?</base:RequestID>" + "<base:AccessCredentials>" + "<base:AccessLicense>" + accessLicense + "</base:AccessLicense>" + "<base:Timestamp>" + timestamp + "</base:Timestamp>" + "<base:Signature>" + signature + "</base:Signature>" + "</base:AccessCredentials>" + "<base:DetailLevel>Full</base:DetailLevel>" + "<base:Version>2.0</base:Version>" + "<base:InquiryTimeFrom>" + NaverCheckOutGetOrder.getYesterday() + "</base:InquiryTimeFrom>" + //NaverCheckOutGetOrder.getYesterday() //2011-05-06T00:00:04.662Z "<base:InquiryTimeTo>" + NaverCheckOutGetOrder.getToday() + "</base:InquiryTimeTo>" + //NaverCheckOutGetOrder.getToday() //2011-05-06T23:00:04.662Z "</mall:GetPaidOrderListRequest>" + "</soapenv:Body>" + "</soapenv:Envelope>"; //2011-07-29T04:33:52.881Z //Create socket //String hostname = "ec.api.naver.com"; String hostname = "api.naver.com"; int port = 80; InetAddress addr = InetAddress.getByName(hostname); Socket sock = new Socket(addr, port); //Send header String path = "/Checkout/MallService2"; BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream(), "UTF-8")); // You can use "UTF8" for compatibility with the Microsoft virtual machine. wr.write("POST " + path + " HTTP/1.0 \r\n"); //wr.write("Host: ec.api.naver.com \r\n"); wr.write("Host: api.naver.com \r\n"); //wr.write("Content-Length: " + xmldata.length() + "\r\n"); wr.write("Content-Length: " + orderlist.length() + "\r\n"); wr.write("Content-Type: text/xml; charset=\"UTF-8\"\r\n"); //wr.write("SOAPAction: \"http://ec.api.naver.com/Checkout/MallService2\" \r\n"); wr.write("SOAPAction: \"http://api.naver.com/Checkout/MallService2\" \r\n"); wr.write("\r\n"); //Send data //wr.write(xmldata); wr.write(orderlist); wr.flush(); // InputStream test = new InputStream(sock.getInputStream(),"UTF-8"); // Response BufferedReader rd = new BufferedReader(new InputStreamReader(sock.getInputStream(), "UTF-8")); String line = ""; String line_total = ""; String tmp = ""; String tmp2 = ""; String newxml = ""; /*while((line = rd.readLine()) != null){ if (line.startsWith("<?xml")){ line = line.replaceAll("
", " "); line_total= line_total + line ; System.out.println(line); } }*/ StringBuffer sf = new StringBuffer(); /* while((line = rd.readLine()) != null){ if (line.startsWith("<?xml")){ sf.append(line+"\n"); // . } }*/ char[] bufferResult = new char[1048576]; int index = -1; while ((index = rd.read(bufferResult)) != -1) { sf.append(bufferResult, 135, index); //response 133 135 } line_total = sf.toString().trim(); System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"); line_total = line_total.replaceAll("n1:", ""); System.out.println(line_total); //xml2 InputStream in = new ByteArrayInputStream(line_total.getBytes("UTF-8")); SAXBuilder builder = new SAXBuilder(); Document document = builder.build(in); Element element = document.getRootElement(); List envel_list = element.getChildren(); List body_list = null; List body_list1 = null; List result_list = null; List result_list1 = null; List result_list2 = null; List result_list3 = null; List result_list4 = null; List result_list5 = null; List info_list = null; List contr_group_list = null; List contr_info_list = null; StringBuffer selectChk = new StringBuffer(); selectChk.append(" select count(*) cnt \n"); selectChk.append(" from ktc_njoyny_hmall_if \n"); selectChk.append(" where h_order_no = ? and coven_id = 26050 \n"); String getInterfacedata = " select UNIT_ID,ITEM_ID " + " from ( " + " select item_id, " + " UNIT_name, " + " decode(( " + " select count(*) cnt " + " from ktc_unit " + " where item_id = ? " + " group by item_id), 1, UNIT_id, decode(trim(UNIT_NAME) ,trim(?), UNIT_id, '')) UNIT_id " + " from ktc_unit " + " where item_id = ? ) " + " where unit_id is not null "; PreparedStatement pstmt = null; ResultSet rs = null; CallableStatement cStmt = null; System.out.println("DBconnect"); //conn.setAutoCommit(false); long UNIT_ID = 0; long cnt = 0; long interface_seq = 0; long DEL_QTY = 0; long ITEM_ID = 0; String ITEM_NAME = null; System.out.println("envel_list.size:" + envel_list.size()); Element envel_el = (Element) envel_list.get(0); body_list = envel_el.getChildren(); System.out.println("+++++++11+++++++++++el.getName() : " + envel_el.getChildren()); System.out.println("body_list.size:" + body_list.size()); Element body_el = (Element) body_list.get(0); result_list = body_el.getChildren("PaidOrderList"); System.out.println("++++++++22++++++++++el.getName() : " + body_el.getChildren()); for (int h = 0; h < result_list.size(); h++) { System.out.println("$$111$$"); Element body_el1 = (Element) result_list.get(h); System.out.println("$$222$$"); result_list1 = body_el1.getChildren("PaidOrder"); System.out.println("result_list1.size:" + result_list1.size()); System.out.println("$$333$$"); System.out.println("++++++++33++++++++++el.getName() : " + body_el1.getChildren()); for (int i = 0; i < result_list1.size(); i++) { System.out.println("$$4444$$" + result_list1.size()); Element body_el2 = (Element) result_list1.get(i); result_list2 = body_el2.getChildren("Order"); Element body_el3 = (Element) result_list1.get(i); result_list3 = body_el3.getChildren("OrderProductList"); Element body_el4 = (Element) result_list1.get(i); result_list4 = body_el4.getChildren("Shipping"); for (int j = 0; j < result_list2.size(); j++) { Element body_el5 = (Element) result_list2.get(j);// Element body_el7 = (Element) result_list4.get(j);// Element body_el8 = (Element) result_list3.get(j); result_list5 = body_el8.getChildren("OrderProduct");// //result_list5 = (Element) result_list3.get(j);// System.out.println("$$55555$$"); if (body_el5.getChildText("OrderStatusCode").equals("OD0002")) {// pstmt = conn.prepareStatement(selectChk.toString()); pstmt.setString(1, body_el5.getChildText("OrderID")); rs = pstmt.executeQuery(); if (rs.next()) { cnt = rs.getLong("cnt"); } System.out.println(" cnt:" + cnt); if (rs != null) { try { rs.close(); } catch (Exception e) { response_type = "FALSE"; } } if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { response_type = "FALSE"; } } System.out.println("result_list5.size():" + result_list5.size()); for (int k = 0; k < result_list5.size(); k++) { Element body_el9 = (Element) result_list5.get(k); ITEM_NAME = body_el9.getChildText("ProductName"); DEL_QTY = Long.parseLong(body_el9.getChildText("Quantity")); pstmt = conn.prepareStatement(getInterfacedata); System.out.println("body_el9.getChildText:" + body_el9.getChildText("ProductID")); System.out .println("body_el9.getChildText:" + body_el9.getChildText("ProductOption")); pstmt.setLong(1, Long.parseLong(body_el9.getChildText("ProductID"))); pstmt.setString(2, body_el9.getChildText("ProductOption")); pstmt.setLong(3, Long.parseLong(body_el9.getChildText("ProductID"))); rs = pstmt.executeQuery(); if (rs.next()) { UNIT_ID = rs.getLong("UNIT_ID"); ITEM_ID = rs.getLong("ITEM_ID"); //DEL_QTY = rs.getLong("DEL_QTY"); } System.out.println("UNIT_ID:" + UNIT_ID); System.out.println("ITEM_ID:" + ITEM_ID); System.out.println("ITEM_NAME:" + ITEM_NAME); if (rs != null) { try { rs.close(); } catch (Exception e) { response_type = "FALSE"; } } if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { response_type = "FALSE"; } } } // 1 . System.out.println("1111 333331"); String getInterfaceSeq = " select ktc_njoyny_hmall_if_seq.nextval interfaceSeq from dual "; pstmt = conn.prepareStatement(getInterfaceSeq); rs = pstmt.executeQuery(); if (rs.next()) { interface_seq = rs.getLong("interfaceSeq"); } System.out.println("+ interface_seq [" + interface_seq + "]"); if (rs != null) { try { rs.close(); } catch (Exception e) { response_type = "FALSE"; } } if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { response_type = "FALSE"; } } if (cnt == 0) { // .. System.out.println("body_el5.getChildText:" + body_el5.getChildText("OrderID")); if (NaverCheckOutGetOrder.run2(body_el5.getChildText("OrderID")) .equals("SUCCESS")) {// StringBuffer setOrder = new StringBuffer(); setOrder.append(" insert \n"); setOrder.append(" into ktc_njoyny_hmall_if( \n"); setOrder.append(" h_order_no, seq, order_date, recv_date, item_id, \n"); setOrder.append(" unit_id, item_name, price, qty, orderer_name, \n"); setOrder.append( " orderer_phone, orderer_cell_phone, orderer_eng_name, orderer_resi_no, orderer_email, \n"); setOrder.append( " msg_for_mall, del_plan_date, receiver_name, receiver_phone, receiver_cell_phone, \n"); setOrder.append( " receiver_zip_code, receiver_addr1, receiver_addr2, msg_for_outbnd, interface_date, \n"); setOrder.append(" interface_seq, sysregdt, coven_id \n"); setOrder.append(" ) values ( \n"); setOrder.append( " 'naver_'||?, ktc_njoyny_hmall_if_seq.nextval, to_date(?,'yyyy/mm/dd hh24:mi:ss'), sysdate, ?, \n"); setOrder.append(" ?, ?, ?, ?, ?, \n"); setOrder.append(" ?, ?, ?, ?, ?, \n"); setOrder.append(" ?, sysdate+5, ?, ?, ?, \n"); setOrder.append(" ?, ?, ?, ?, sysdate, \n"); setOrder.append(" ?, sysdate, ? \n"); setOrder.append(" ) \n"); pstmt = conn.prepareStatement(setOrder.toString()); int insert_cnt = 0; try { pstmt.clearParameters(); // pstmt.setLong(1, Long.parseLong(body_el5.getChildText("OrderID"))); // h_order_no System.out.println(body_el5.getChildText("OrderID")); pstmt.setString(2, body_el5.getChildText("OrderDateTime").substring(0, 10)); //order_date System.out.println(body_el5.getChildText("OrderDateTime").substring(0, 10)); pstmt.setLong(3, ITEM_ID); // item_id System.out.println(ITEM_ID); pstmt.setLong(4, UNIT_ID); // unit_id System.out.println(UNIT_ID); pstmt.setString(5, ITEM_NAME); // ITEM_NAME System.out.println(ITEM_NAME); pstmt.setLong(6, Long.parseLong(body_el5.getChildText("TotalProductAmount"))); //price -> 0.95 + + System.out.println( Long.parseLong(body_el5.getChildText("TotalProductAmount"))); pstmt.setLong(7, DEL_QTY); //qty System.out.println(DEL_QTY); pstmt.setString(8, new String(SimpleCryptLib.decrypt(encryptKey, body_el5.getChildText("OrdererName")), "UTF-8")); // orderer_name System.out.println(new String(SimpleCryptLib.decrypt(encryptKey, body_el5.getChildText("OrdererName")), "UTF-8")); pstmt.setString(9, NaverCheckOutGetOrder .getTel(new String( SimpleCryptLib.decrypt(encryptKey, body_el5.getChildText("OrdererTel")), "UTF-8"))); //orderer_phone System.out .println( NaverCheckOutGetOrder .getTel(new String( SimpleCryptLib .decrypt(encryptKey, body_el5.getChildText( "OrdererTel")), "UTF-8"))); pstmt.setString(10, NaverCheckOutGetOrder .getTel(new String( SimpleCryptLib.decrypt(encryptKey, body_el5.getChildText("OrdererTel")), "UTF-8"))); // orderer_cell_phone pstmt.setString(11, null); // orderer_eng_name pstmt.setString(12, null); // orderer_resi_no pstmt.setString(13, null); // orderer_email pstmt.setString(14, body_el7.getChildText("ShippingMessage")); // msg_for_mall pstmt.setString(15, new String(SimpleCryptLib.decrypt(encryptKey, body_el7.getChildText("Recipient")), "UTF-8")); // receiver_name System.out.println(new String(SimpleCryptLib.decrypt(encryptKey, body_el7.getChildText("Recipient")), "UTF-8")); pstmt.setString(16, NaverCheckOutGetOrder .getTel(new String( SimpleCryptLib.decrypt(encryptKey, body_el7.getChildText("RecipientTel1")), "UTF-8"))); // receiver_phone System.out .println( NaverCheckOutGetOrder .getTel(new String( SimpleCryptLib.decrypt(encryptKey, body_el7.getChildText( "RecipientTel1")), "UTF-8"))); pstmt.setString(17, NaverCheckOutGetOrder .getTel(new String( SimpleCryptLib.decrypt(encryptKey, body_el7.getChildText("RecipientTel1")), "UTF-8"))); // receiver_cell_phone System.out .println( NaverCheckOutGetOrder .getTel(new String( SimpleCryptLib.decrypt(encryptKey, body_el7.getChildText( "RecipientTel1")), "UTF-8"))); pstmt.setString(18, body_el7.getChildText("ZipCode")); //receiver_zip_code pstmt.setString(19, new String( SimpleCryptLib.decrypt(encryptKey, body_el7.getChildText("ShippingAddress1")), "UTF-8")); //receiver_addr1 System.out.println(new String(SimpleCryptLib.decrypt(encryptKey, body_el7.getChildText("ShippingAddress1")), "UTF-8")); pstmt.setString(20, new String( SimpleCryptLib.decrypt(encryptKey, body_el7.getChildText("ShippingAddress2")), "UTF-8")); //receiver_addr2 System.out.println(new String(SimpleCryptLib.decrypt(encryptKey, body_el7.getChildText("ShippingAddress2")), "UTF-8")); pstmt.setString(21, body_el7.getChildText("ShippingMessage")); // msg_for_outbnd System.out.println(body_el7.getChildText("ShippingMessage")); pstmt.setLong(22, interface_seq); // interface_seq pstmt.setString(23, "26050"); // coven_id pstmt.executeUpdate(); System.out.println("\n+ insert_cnt [" + i + "]\n"); } catch (Exception e) { response_type = "FALSE"; e.printStackTrace(); conn.rollback(); break; } conn.commit(); if (pstmt != null) { try { pstmt.close(); } catch (Exception ex) { response_type = "FALSE"; } } System.out.println(" "); System.out.println("interface_seq:" + interface_seq); // .... cStmt = conn.prepareCall("{ call CREAT_NJOYNY_HMALL_ORDER(?,?,?) }"); cStmt.setLong(1, interface_seq); cStmt.registerOutParameter(2, Types.VARCHAR); cStmt.registerOutParameter(3, Types.VARCHAR); cStmt.executeUpdate(); String r_code = cStmt.getString(2); String r_msg = cStmt.getString(3); System.out.println("++++++++++++++++r_code : " + r_code); System.out.println("++++++++++++++++r_msg : " + r_msg); conn.commit(); System.out.println(" "); if (cStmt != null) { try { cStmt.close(); } catch (Exception e) { response_type = "FALSE"; } } conn.setAutoCommit(true); response_type = "TRUE"; } else { System.out.println(" "); } } else { System.out.println(" =.."); } cnt = 0; // .. } } } } } catch (Exception e) { System.out.println("run() : " + e.getMessage()); response_type = "FALSE"; } finally { } return response_type; }
From source file:NaverShopnSendItem_test.java
private String run4(String ProductId, String n_item_id, Integer cnt) { // // // w w w. jav a 2 s . co m // String response_type = "FALSE"; NaverShopnSendItem_test NaverShopnSendItem_test = new NaverShopnSendItem_test(); System.out.println("run4"); try { /* */ // SimpleCryptLib SimpleCryptLib = new SimpleCryptLib(); Security.addProvider(new BouncyCastleProvider()); String accessLicense = "0100010000f3814c41974dc3e7f98d1cd213fa8b84c396872ff6c1abb57f0d2516f31cfb43"; String secretKey = "AQABAADKObge3IgWtlgfbo1TaLqHKpjfyGNKYuZbfOZB8m+WJA=="; String serviceName = "ProductService"; // String id = "eugink"; String password = "asdf0101"; String timestamp = null; String signature = null; String data = null; String item_id = ""; byte[] encryptKey = null; String encryptedData = null; String decryptedData = null; String hashedData = null; String operationName = "GetOption"; String ResponseType = ""; PreparedStatement pstmt = null; ResultSet rs = null; CallableStatement cStmt = null; operationName = "ManageOption"; // String orderID = "200087036"; // timestamp create timestamp = SimpleCryptLib.getTimestamp(); System.out.println("timestamp:" + timestamp); System.out.println("ManageOption"); // generateSign data = timestamp + serviceName + operationName; signature = SimpleCryptLib.generateSign(data, secretKey); // generateKey encryptKey = SimpleCryptLib.generateKey(timestamp, secretKey); // encrypt encryptedData = SimpleCryptLib.encrypt(encryptKey, password.getBytes("UTF-8")); // decrypt decryptedData = new String(SimpleCryptLib.decrypt(encryptKey, encryptedData), "UTF-8"); // sha256 hashedData = SimpleCryptLib.sha256(password); // StringBuffer unitlistsql = new StringBuffer(); // try { StringBuffer selectUnit = new StringBuffer(); selectUnit.append(" select unit_name,co_unit_id,unit_id, vir_stock_qty ,use_yn \n"); selectUnit.append(" from ( \n"); selectUnit.append( " select nvl(b.coven_id,0) coven_id,decode(a.use_yn , 'Y',a.unit_name,(a.unit_name||'('||a.unit_id||')')) unit_name,nvl(b.co_unit_id,0) co_unit_id,a.unit_id,(CASE WHEN vir_stock_qty <= 0 then decode(use_yn,'Y',1,0) else decode(use_yn,'Y',vir_stock_qty,0) end) vir_stock_qty,decode(a.use_yn,'Y','Y','N') use_yn \n"); selectUnit.append(" from ktc_unit a,ktc_unit_interlock b \n"); selectUnit.append(" where a.unit_id = b.unit_id(+) \n"); selectUnit.append(" and a.unit_name is not null \n"); selectUnit.append(" and a.item_id = ? \n"); selectUnit.append(" )where coven_id in (27346,0) \n"); //System.out.println("selectUnit.toString():"+ selectUnit.toString()); HashMap unitList = new HashMap(); pstmt = conn.prepareStatement(selectUnit.toString()); // pstmt.clearParameters(); // pstmt.setString(1, n_item_id); rs = pstmt.executeQuery(); int list_cnt = 1; while (rs.next()) { HashMap rowData = new HashMap(); rowData.put("unit_name", rs.getString("unit_name")); rowData.put("co_unit_id", rs.getString("co_unit_id")); rowData.put("unit_id", rs.getString("unit_id")); rowData.put("vir_stock_qty", rs.getString("vir_stock_qty")); rowData.put("use_yn", rs.getString("use_yn")); unitList.put(Integer.toString(list_cnt), rowData); list_cnt = list_cnt + 1; } /* unit xml */ unitlistsql.append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n "); unitlistsql.append( "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:shop=\"http://shopn.platform.nhncorp.com/\"> "); unitlistsql.append( " <soap:Header/> "); unitlistsql.append( " <soap:Body> "); unitlistsql.append( " <shop:ManageOptionRequest> "); unitlistsql.append( " <!--Optional:--> "); unitlistsql.append(" <shop:RequestID>njoyny2</shop:RequestID>"); unitlistsql.append(" <shop:AccessCredentials>"); unitlistsql.append(" <shop:AccessLicense>" + accessLicense + "</shop:AccessLicense>"); unitlistsql.append(" <shop:Timestamp>" + timestamp + "</shop:Timestamp>"); unitlistsql.append(" <shop:Signature>" + signature + "</shop:Signature>"); unitlistsql.append(" </shop:AccessCredentials>"); unitlistsql.append(" <shop:Version>2.0</shop:Version>"); unitlistsql.append(" <SellerId>njoyny2</SellerId>"); unitlistsql.append( " <Option> "); unitlistsql.append(" <shop:ProductId>" + ProductId + "</shop:ProductId> "); unitlistsql.append( " <!--Optional:--> "); unitlistsql.append( " <shop:Combination> "); unitlistsql.append(" <shop:Names> "); unitlistsql.append(" <shop:Name1><![CDATA[]]></shop:Name1> "); unitlistsql.append(" </shop:Names> "); unitlistsql.append(" <shop:ItemList> "); System.out.println("unitlistsql:" + unitlistsql); System.out.println("!!!!cnt:" + cnt); String unit_name = ""; String co_unit_id = ""; String unit_id = ""; String vir_stock_qty = ""; String use_yn = ""; HashMap rowData1 = null; for (int j = 1; j <= cnt; j++) { rowData1 = (HashMap) unitList.get(String.valueOf(j)); unit_name = NaverShopnSendItem_test.parsingSpecialforXml((String) rowData1.get("unit_name")) .replaceAll(":", "-"); // njoyny id co_unit_id = (String) rowData1.get("co_unit_id"); // shopN // id unit_id = (String) rowData1.get("unit_id"); vir_stock_qty = (String) rowData1.get("vir_stock_qty"); use_yn = (String) rowData1.get("use_yn"); unitlistsql.append( " <shop:Item> "); if (!co_unit_id.equals("0")) { unitlistsql.append(" <shop:Id>" + co_unit_id + "</shop:Id> "); } unitlistsql.append(" <shop:Value1>" + unit_name + "</shop:Value1> "); unitlistsql.append(" <shop:Quantity>" + vir_stock_qty + "</shop:Quantity> "); unitlistsql.append(" <shop:SellerManagerCode>" + unit_id + "</shop:SellerManagerCode> "); unitlistsql.append(" <shop:Usable>" + use_yn + "</shop:Usable> "); unitlistsql.append( " </shop:Item> "); } unitlistsql.append(" </shop:ItemList> "); unitlistsql.append( " </shop:Combination> "); unitlistsql.append( " </Option> "); unitlistsql.append( " </shop:ManageOptionRequest> "); unitlistsql.append( " </soap:Body> "); unitlistsql.append( "</soap:Envelope> "); /* unit xml */ System.out.println("unitlist:" + unitlistsql.toString()); if (rs != null) { try { rs.close(); } catch (Exception e) { response_type = "FALSE"; } } if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { response_type = "FALSE"; } } } catch (Exception e) { System.out.println("run4() : " + e.getMessage()); } finally { } //System.out.println(unitlistsql.toString()); String line_total = ""; URL url = new URL("http://ec.api.naver.com/ShopN/ProductService"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoOutput(true); con.setRequestMethod("POST"); con.setDoOutput(true); // . true. con.setDoInput(true); con.setUseCaches(false); con.setDefaultUseCaches(false); // Header con.addRequestProperty("Content-Type", "text/xml;charset=UTF-8"); // BODY OutputStreamWriter wr = new OutputStreamWriter(con.getOutputStream(), "UTF-8"); wr.write(unitlistsql.toString()); wr.flush(); // String inputLine = null; BufferedReader rd = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); while ((inputLine = rd.readLine()) != null) { line_total = line_total + inputLine; //System.out.println(inputLine); } rd.close(); wr.close(); line_total = line_total.replaceAll("n:", ""); System.out.println(line_total); // xml2 InputStream in = new ByteArrayInputStream(line_total.getBytes("UTF-8")); SAXBuilder builder = new SAXBuilder(); Document document = builder.build(in); Element element = document.getRootElement(); List envel_list = element.getChildren(); //System.out.println("envel_list:" + envel_list); List body_list = null; List body_list1 = null; List result_list = null; List result_list1 = null; List result_list2 = null; List result_list3 = null; List result_list4 = null; List result_list5 = null; List info_list = null; List contr_group_list = null; List contr_info_list = null; pstmt = null; rs = null; cStmt = null; //System.out.println("envel_list.size:" + envel_list.size()); Element envel_el = (Element) envel_list.get(0); body_list = envel_el.getChildren(); //System.out.println("body_list.size:" + body_list.size()); Element body_el = (Element) body_list.get(0); result_list = body_el.getChildren("ManageProductResponse"); ResponseType = body_el.getChildText("ResponseType"); ProductId = body_el.getChildText("ProductId"); //System.out.println("ResponseType:"+ body_el.getChildText("ResponseType")); System.out.println("ProductId:" + body_el.getChildText("ProductId")); StringBuffer optlistsql = new StringBuffer(); if (ResponseType.equals("SUCCESS")) { // NaverShopnSendItem_test.run3(ProductId, n_item_id); } } catch (Exception e) { System.out.println("run111() : " + e.getMessage()); } finally { } return response_type; }
From source file:NaverShopnSendItem_test.java
private String run3(String ProductId, String n_item_id) { // System.out.println("run3"); String response_type = "FALSE"; NaverShopnSendItem_test NaverShopnSendItem_test = new NaverShopnSendItem_test(); try {// w ww. java 2s .co m SimpleCryptLib SimpleCryptLib = new SimpleCryptLib(); Security.addProvider(new BouncyCastleProvider()); String accessLicense = "0100010000f3814c41974dc3e7f98d1cd213fa8b84c396872ff6c1abb57f0d2516f31cfb43"; String secretKey = "AQABAADKObge3IgWtlgfbo1TaLqHKpjfyGNKYuZbfOZB8m+WJA=="; String serviceName = "ProductService"; // String id = "eugink"; String password = "asdf0101"; String timestamp = null; String signature = null; String data = null; String item_id = ""; byte[] encryptKey = null; String encryptedData = null; String decryptedData = null; String hashedData = null; String operationName = "GetOption"; String ResponseType = ""; PreparedStatement pstmt = null; ResultSet rs = null; CallableStatement cStmt = null; // String orderID = "200087036"; // timestamp create timestamp = SimpleCryptLib.getTimestamp(); System.out.println("timestamp:" + timestamp); System.out.println("ProductService"); // generateSign data = timestamp + serviceName + operationName; signature = SimpleCryptLib.generateSign(data, secretKey); // generateKey encryptKey = SimpleCryptLib.generateKey(timestamp, secretKey); // encrypt encryptedData = SimpleCryptLib.encrypt(encryptKey, password.getBytes("UTF-8")); // decrypt decryptedData = new String(SimpleCryptLib.decrypt(encryptKey, encryptedData), "UTF-8"); // sha256 hashedData = SimpleCryptLib.sha256(password); StringBuffer optlistsql = new StringBuffer(); optlistsql.append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n "); optlistsql.append( "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:shop=\"http://shopn.platform.nhncorp.com/\"> "); optlistsql.append( " <soap:Header/> "); optlistsql.append( " <soap:Body> "); optlistsql.append( " <shop:GetOptionRequest> "); optlistsql.append(" <shop:RequestID>njoyny2</shop:RequestID>"); optlistsql.append(" <shop:AccessCredentials>"); optlistsql.append(" <shop:AccessLicense>" + accessLicense + "</shop:AccessLicense>"); optlistsql.append(" <shop:Timestamp>" + timestamp + "</shop:Timestamp>"); optlistsql.append(" <shop:Signature>" + signature + "</shop:Signature>"); optlistsql.append(" </shop:AccessCredentials>"); optlistsql.append(" <shop:Version>2.0</shop:Version>"); optlistsql.append(" <SellerId>njoyny2</SellerId>"); optlistsql.append(" <shop:ProductId>" + ProductId + "</shop:ProductId> "); optlistsql.append( " </shop:GetOptionRequest> "); optlistsql.append(" </soap:Body> "); optlistsql.append(" </soap:Envelope> "); System.out.println("optlistsql:" + optlistsql); String line_total = ""; URL url = new URL("http://ec.api.naver.com/ShopN/ProductService"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoOutput(true); con.setRequestMethod("POST"); con.setDoOutput(true); // . true. con.setDoInput(true); con.setUseCaches(false); con.setDefaultUseCaches(false); // Header con.addRequestProperty("Content-Type", "text/xml;charset=UTF-8"); // BODY OutputStreamWriter wr = new OutputStreamWriter(con.getOutputStream(), "UTF-8"); wr.write(optlistsql.toString()); wr.flush(); // String inputLine = null; BufferedReader rd = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); while ((inputLine = rd.readLine()) != null) { line_total = line_total + inputLine; //System.out.println(inputLine); } rd.close(); wr.close(); line_total = line_total.replaceAll("n:", ""); //System.out.println(line_total); // xml2 ByteArrayInputStream in = new ByteArrayInputStream(line_total.getBytes("UTF-8")); SAXBuilder builder = new SAXBuilder(); Document document = builder.build(in); Element element = document.getRootElement(); List envel_list = element.getChildren(); //System.out.println("envel_list:" + envel_list); List body_list = null; List body_list1 = null; List result_list = null; List result_list1 = null; List result_list2 = null; List result_list3 = null; List result_list4 = null; List result_list5 = null; List info_list = null; List contr_group_list = null; List contr_info_list = null; Element envel_el = (Element) envel_list.get(0); body_list = envel_el.getChildren(); Element body_el = (Element) body_list.get(0); result_list = body_el.getChildren("Option"); Element body_el1 = (Element) result_list.get(0); result_list1 = body_el1.getChildren("Combination"); Element body_el2 = (Element) result_list1.get(0); result_list2 = body_el2.getChildren("ItemList"); Element body_el3 = (Element) result_list2.get(0); result_list3 = body_el3.getChildren("Item"); Element body_el4 = null; int cnt = 0; for (int h = 0; h < result_list3.size(); h++) { body_el4 = (Element) result_list3.get(h); StringBuffer unitCnt = new StringBuffer(); unitCnt.append(" select count(*) cnt \n"); unitCnt.append(" from \n"); unitCnt.append(" ktc_unit_interlock \n"); unitCnt.append(" where coven_id = 27346 and unit_id = ? \n"); // pstmt.clearParameters(); pstmt = conn.prepareStatement(unitCnt.toString()); pstmt.setLong(1, Long.parseLong(body_el4.getChildText("SellerManagerCode"))); // pstmt.setString(1, body_el3.getChildText("Value")); // // h_order_no rs = pstmt.executeQuery(); System.out .println("SellerManagerCode:" + Long.parseLong(body_el4.getChildText("SellerManagerCode"))); while (rs.next()) { cnt = rs.getInt("cnt"); } System.out.println("cnt1:" + cnt); if (rs != null) try { rs.close(); } catch (Exception e) { } if (pstmt != null) try { pstmt.close(); } catch (Exception e) { } if (cnt == 0) { System.out.println("insert!!!!!!!!!!!!!!!!!!"); StringBuffer setCovenID = new StringBuffer(); setCovenID.append( " insert into ktc_unit_interlock(coven_id , co_unit_id , item_id , unit_id ,insert_date,update_date) \n"); setCovenID.append(" values (27346,?,?,?,sysdate,sysdate) \n"); //System.out.println("setCovenIDinsert::"+ setCovenID.toString()); pstmt = conn.prepareStatement(setCovenID.toString()); int insert_cnt = 0; try { // pstmt.clearParameters(); // pstmt.setString(1, body_el4.getChildText("Id")); // id pstmt.setString(2, n_item_id); // id pstmt.setString(3, body_el4.getChildText("SellerManagerCode")); // unit_id pstmt.executeUpdate(); System.out.println("insert end"); if (rs != null) try { rs.close(); } catch (Exception e) { } if (pstmt != null) try { pstmt.close(); } catch (Exception e) { } } catch (Exception e) { System.out.println("insert unit error!!!"); response_type = "FALSE"; e.printStackTrace(); conn.rollback(); } } else { System.out.println("update!!!!!!!!!!!!!!!!!!"); StringBuffer setCovenID = new StringBuffer(); setCovenID.append(" update ktc_unit_interlock set \n"); setCovenID.append(" co_unit_id = ? ,item_id = ? ,update_date = sysdate \n"); setCovenID.append(" where coven_id = 27346 and unit_id = ? \n"); pstmt = conn.prepareStatement(setCovenID.toString()); System.out.println("setCovenID.toString()!!!!!!!!!!!!!!!!!!" + setCovenID.toString()); int insert_cnt = 0; try { // pstmt.setString(1, body_el4.getChildText("Id")); // id pstmt.setString(2, n_item_id); // id pstmt.setString(3, body_el4.getChildText("SellerManagerCode")); // unit_id System.out.println("Id!!!!!!!!!!!!!!!!!!" + body_el4.getChildText("Id")); System.out.println("n_item_id!!!!!!!!!!!!!!!!!!" + n_item_id); System.out.println( "SellerManagerCode!!!!!!!!!!!!!!!!!!" + body_el4.getChildText("SellerManagerCode")); pstmt.executeUpdate(); System.out.println("end update111"); if (rs != null) try { rs.close(); } catch (Exception e) { } if (pstmt != null) try { pstmt.close(); } catch (Exception e) { } } catch (Exception e) { System.out.println("update unit error!!!"); response_type = "FALSE"; e.printStackTrace(); conn.rollback(); } } } ResponseType = body_el.getChildText("ResponseType"); ProductId = body_el.getChildText("ProductId"); } catch (Exception e) { System.out.println("insert update unit error!!!"); System.out.println("run3() : " + e.getMessage()); response_type = "FALSE"; } finally { } return response_type; }
From source file:NaverShopnSendItem_test.java
private String run2(String imgUrl) { // String response_type = "FALSE"; NaverShopnSendItem_test NaverShopnSendItem_test = new NaverShopnSendItem_test(); try {/* w ww. j a v a2 s . c om*/ SimpleCryptLib SimpleCryptLib = new SimpleCryptLib(); Security.addProvider(new BouncyCastleProvider()); String accessLicense = "0100010000f3814c41974dc3e7f98d1cd213fa8b84c396872ff6c1abb57f0d2516f31cfb43"; String secretKey = "AQABAADKObge3IgWtlgfbo1TaLqHKpjfyGNKYuZbfOZB8m+WJA=="; String serviceName = "ImageService"; // String id = "eugink"; String password = "asdf0101"; String timestamp = null; String signature = null; String data = null; byte[] encryptKey = null; String encryptedData = null; String decryptedData = null; String hashedData = null; String operationName = "UploadImage"; // String orderID = "200087036"; // timestamp create timestamp = SimpleCryptLib.getTimestamp(); System.out.println("timestamp:" + timestamp); System.out.println("ImageService"); // generateSign data = timestamp + serviceName + operationName; signature = SimpleCryptLib.generateSign(data, secretKey); // generateKey encryptKey = SimpleCryptLib.generateKey(timestamp, secretKey); // encrypt encryptedData = SimpleCryptLib.encrypt(encryptKey, password.getBytes("UTF-8")); // decrypt decryptedData = new String(SimpleCryptLib.decrypt(encryptKey, encryptedData), "UTF-8"); // sha256 hashedData = SimpleCryptLib.sha256(password); String imglist = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:shop=\"http://shopn.platform.nhncorp.com/\">" + "<soap:Header/>" + "<soap:Body>" + "<shop:UploadImageRequest>" + "<!--Optional:-->" + "<shop:RequestID>njoyny2</shop:RequestID>" + "<shop:AccessCredentials>" + "<shop:AccessLicense>" + accessLicense + "</shop:AccessLicense>" + "<shop:Timestamp>" + timestamp + "</shop:Timestamp>" + "<shop:Signature>" + signature + "</shop:Signature>" + "</shop:AccessCredentials>" + "<shop:Version>2.0</shop:Version>" + "<SellerId>njoyny2</SellerId>" + "<ImageURLList>" + "<!--Zero or more repetitions:-->" + "<shop:URL>" + imgUrl + "</shop:URL>" + "</ImageURLList>" + "</shop:UploadImageRequest>" + "</soap:Body>" + "</soap:Envelope>"; // Create socket String hostname = "ec.api.naver.com"; // String hostname = "api.naver.com"; int port = 80; InetAddress addr = InetAddress.getByName(hostname); Socket sock = new Socket(addr, port); // Send header String path = "/ShopN/ImageService"; BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream(), "UTF-8")); // You can use "UTF8" for compatibility with the Microsoft virtual // machine. wr.write("POST " + path + " HTTP/1.0 \r\n"); wr.write("Host: ec.api.naver.com \r\n"); // wr.write("Host: api.naver.com \r\n"); // wr.write("Content-Length: " + xmldata.length() + "\r\n"); wr.write("Content-Length: " + imglist.length() + "\r\n"); wr.write("Content-Type: text/xml; charset=\"UTF-8\"\r\n"); wr.write("SOAPAction: \"http://ec.api.naver.com/ShopN/ImageService\" \r\n"); // wr.write("SOAPAction: \"http://api.naver.com/Checkout/MallService2\" \r\n"); wr.write("\r\n"); // Send data // wr.write(xmldata); wr.write(imglist); wr.flush(); // InputStream test = new // InputStream(sock.getInputStream(),"UTF-8"); // Response BufferedReader rd = new BufferedReader(new InputStreamReader(sock.getInputStream(), "UTF-8")); String line = ""; String line_total = ""; String tmp = ""; String tmp2 = ""; String newxml = ""; while ((line = rd.readLine()) != null) { if (line.startsWith("<?xml")) { line = line.replaceAll("
", " "); line_total = line_total + line; //System.out.println(line); } } rd.close(); wr.close(); line_total = line_total.replaceAll("n:", ""); //System.out.println(line_total); line_total = line_total.replaceAll("n:", ""); // System.out.println(sf.toString().trim()); // xml2 InputStream in = new ByteArrayInputStream(line_total.getBytes("UTF-8")); SAXBuilder builder = new SAXBuilder(); Document document = builder.build(in); Element element = document.getRootElement(); List envel_list = element.getChildren(); List body_list = null; List body_list1 = null; List result_list = null; List result_list1 = null; List result_list2 = null; List result_list3 = null; List result_list4 = null; List result_list5 = null; List info_list = null; List contr_group_list = null; List contr_info_list = null; PreparedStatement pstmt = null; ResultSet rs = null; CallableStatement cStmt = null; // conn.setAutoCommit(false); long UNIT_ID = 0; long cnt = 0; long interface_seq = 0; long DEL_QTY = 0; long ITEM_ID = 0; String ITEM_NAME = null; Element envel_el = (Element) envel_list.get(0); body_list = envel_el.getChildren(); Element body_el = (Element) body_list.get(0); result_list = body_el.getChildren("ImageList"); for (int h = 0; h < result_list.size(); h++) { Element body_el1 = (Element) result_list.get(h); result_list1 = body_el1.getChildren("Image"); for (int i = 0; i < result_list1.size(); i++) { Element body_el2 = (Element) result_list1.get(i); response_type = body_el2.getChildText("URL"); } } } catch (Exception e) { System.out.println("run2() : " + e.getMessage()); response_type = "FALSE"; } finally { } return response_type; }
From source file:NaverShopnSendItem_test.java
public String run(String InputItem) { StringBuffer itemlist = new StringBuffer(); // String response_type = "FALSE"; PreparedStatement pstmt = null; ResultSet rs = null;/* w w w . jav a 2 s. c om*/ CallableStatement cStmt = null; try { StringBuffer selectItem = new StringBuffer(); selectItem.append(" select \n"); selectItem.append(" a.ITEM_ID , \n"); selectItem.append( " (select b.co_item_id from ktc_item_interlock b where coven_id = 27346 and b.item_id = a.item_id) co_item_id , \n"); //selectItem.append(" (select CASE WHEN sum(decode(use_yn,'Y',vir_stock_qty,0)) < 0 then 0 else sum(decode(use_yn,'Y',vir_stock_qty,0)) end from ktc_unit where item_id = a.item_id ) qty , \n"); selectItem.append( " (select sum(CASE WHEN vir_stock_qty <= 0 then decode(use_yn,'Y',1,0) else decode(use_yn,'Y',vir_stock_qty,0) end) from ktc_unit where item_id = a.item_id ) qty , \n"); selectItem.append(" a.ITEM_GB , \n"); selectItem.append(" a.PRE_ITEM_NAME , \n"); selectItem.append(" a.MODEL , \n"); selectItem.append(" a.STD_CTG_ID , \n"); selectItem.append(" a.START_DATETIME , \n"); selectItem.append(" a.END_DATETIME , \n"); selectItem.append( " decode( (select sum(decode(use_yn,'Y',vir_stock_qty,0)) from ktc_unit where item_id = a.item_id ) , 0, 'SUSP' , decode(a.ITEM_STAT_CODE,120103,'SALE', 'SUSP')) item_stat_code , \n");// SALE()// SUSP()// QSTK()) selectItem.append( " (select b.co_ctg_id from ktc_ctg_interlock b where b.coven_id = 27346 and b.sctg_id in (select c.sctg_id from ktc_ctgitem c where c.item_id = a.item_id) and rownum = 1) co_ctg_id , \n"); // // selectItem.append( " decode((select count(DC_SALE_PRICE) from KTC_SITEITEM where ITEM_ID = a.ITEM_ID and SITE_ID = 10 and sysdate between START_DATETIME and END_DATETIME and sysdate between DC_START_DATETIME and DC_END_DATETIME and rownum = 1), 0, (select SALE_PRICE from KTC_SITEITEM where ITEM_ID = a.ITEM_ID and SITE_ID = 10 and sysdate between START_DATETIME and END_DATETIME and rownum = 1),decode((select DC_SALE_PRICE from KTC_SITEITEM where ITEM_ID = a.ITEM_ID and SITE_ID = 10 and sysdate between START_DATETIME and END_DATETIME and rownum = 1),0,(select SALE_PRICE from KTC_SITEITEM where ITEM_ID = a.ITEM_ID and SITE_ID = 10 and sysdate between START_DATETIME and END_DATETIME and rownum = 1),(select DC_SALE_PRICE from KTC_SITEITEM where ITEM_ID = a.ITEM_ID and SITE_ID = 10 and sysdate between START_DATETIME and END_DATETIME and rownum = 1))) as SALE_PRICE, \n"); selectItem.append(" a.MIN_ORDER_QTY , \n"); selectItem.append(" a.EMP_ID , \n"); selectItem.append(" a.IMPORT_VEN_NAME , \n"); selectItem.append(" a.PACKER_CODE , \n"); selectItem.append(" a.PACK_MATR_CODE , \n"); selectItem.append(" a.STOCK_DIS_YN , \n"); selectItem.append(" a.VEN_ID , \n"); selectItem.append(" a.TAX_GB_CODE , \n"); selectItem.append(" a.ORDER_UNIT_CODE , \n"); selectItem.append(" a.CON_CARD_YN , \n"); selectItem.append(" a.CON_CARD_PRICE , \n"); selectItem.append(" a.ACCOUNT_METHOD_CODE , \n"); selectItem.append(" a.DELY_AREA_CODE , \n"); selectItem.append(" a.LEADTIME_CODE , \n"); selectItem.append(" decode(a.LOW_PRICE_YN,'Y',3,1) LOW_PRICE_YN , \n"); selectItem.append(" a.LOW_PRICE_STD , \n"); selectItem.append(" a.LOW_PRICE_DELY_FEE , \n"); selectItem.append(" a.BUY_TYPE_CODE , \n"); selectItem.append(" a.DELI_TYPE_CODE , \n"); selectItem.append(" a.WHCENTER_CODE , \n"); selectItem.append(" a.GIFT_PACK_YN , \n"); selectItem.append(" a.GIFT_PACK_FEE , \n"); selectItem.append(" a.BRAND_ID , \n"); selectItem.append(" a.QUICK_YN , \n"); selectItem.append(" a.NOINTEREST_YN , \n"); selectItem.append(" a.NEW_YN , \n"); selectItem.append(" a.RECOMM_YN , \n"); selectItem.append(" a.BEST_YN , \n"); selectItem.append(" a.GIFT_SET_ID , \n"); selectItem.append(" a.GIFT_OFFER_CNT_CODE , \n"); selectItem.append(" a.GIFT_ACC_CNT , \n"); selectItem.append(" a.GIFT_LIMIT_CNT , \n"); selectItem.append(" a.GIFT_START_DATETIME , \n"); selectItem.append(" a.GIFT_END_DATETIME , \n"); selectItem.append(" a.HEADCOPY , \n"); selectItem.append(" a.ITEM_DESC , \n"); selectItem.append(" a.ETC , \n"); selectItem.append(" a.IMG_SET_ID , \n"); selectItem.append(" a.GG_PRICE_METH_CODE , \n"); selectItem.append(" a.GG_SLIDE_YN , \n"); selectItem.append(" a.GG_BUY_PRICE , \n"); selectItem.append(" a.GG_SALE_PRICE , \n"); selectItem.append(" a.GG_SLIDE_PRICE , \n"); selectItem.append(" a.GG_SLIDE_QTY , \n"); selectItem.append(" a.GG_SALE_QTY , \n"); selectItem.append(" a.GG_NET_COMMISSION , \n"); selectItem.append(" a.GG_COMMISSION_CODE , \n"); selectItem.append(" a.INSERT_DATE , \n"); selectItem.append(" a.INSERT_ID , \n"); selectItem.append(" a.MODIFY_DATE , \n"); selectItem.append(" a.MODIFY_ID , \n"); selectItem.append( " (select code_val from ktc_code where code_id = a.ORIGIN_NAME ) ORIGIN_NAME , \n"); selectItem.append(" a.BT_YN , \n"); selectItem.append(" a.ITEM_NAME , \n"); selectItem.append(" a.MAKING_VEN_CODE , \n"); selectItem.append(" a.IMGX , \n"); selectItem.append(" a.IMGL1 , \n"); selectItem.append(" a.IMGL2 , \n"); selectItem.append(" a.IMGM1 , \n"); selectItem.append(" a.IMGM2 , \n"); selectItem.append(" a.IMGS1 , \n"); selectItem.append(" a.IMGS2 , \n"); selectItem.append(" a.ITMID , \n"); selectItem.append(" a.STORE_ID , \n"); selectItem.append(" a.REG_METHOD_GB , \n"); selectItem.append(" a.REG_VEN_ID , \n"); selectItem.append(" a.VOD_PATH , \n"); selectItem.append(" a.RTN_YN , \n"); selectItem.append(" a.MALL_NAME , \n"); selectItem.append(" a.MALL_URL , \n"); selectItem.append(" a.HUSOISU_YN , \n"); selectItem.append(" a.PENALTY_YN , \n"); selectItem.append(" a.SEQ_NUM , \n"); selectItem.append(" a.CASH_DISCOUNT_YN , \n"); selectItem.append(" a.TWELVE_H_YN , \n"); selectItem.append(" a.FIX_FEE_YN , \n"); selectItem.append(" a.BUYER_DELY_FEE_YN , \n"); selectItem.append(" a.SETYN , \n"); selectItem.append(" a.VIAKTC , \n"); selectItem.append(" a.PREBUYING , \n"); selectItem.append(" a.ANOTHER_MARKET_YN , \n"); selectItem.append(" a.SPECIAL_DC_FORBID , \n"); selectItem.append(" a.CHINA_COMMERCE_YN , \n"); selectItem.append(" a.MALL_URL2 , \n"); selectItem.append(" a.COUPON_MEMO , \n"); selectItem.append(" a.FASHIONPLUS_YN , \n"); selectItem.append(" a.INTERPARK_YN , \n"); selectItem.append(" a.BUYER_DELY_FEE_PRICE , \n"); selectItem.append(" a.SINGLE_PLANNING , \n"); selectItem.append(" a.CURRENCY , \n"); selectItem.append(" a.OUTSIDE_ID , \n"); selectItem.append(" a.SINGLE_ITEM_YN , \n"); selectItem.append(" a.STYLE_E2A , \n"); selectItem.append(" a.CODYITEM_1 , \n"); selectItem.append(" a.CODYITEM_2 , \n"); selectItem.append(" a.CODYITEM_3 , \n"); selectItem.append(" a.CODYITEM_4 , \n"); selectItem.append(" a.REJECT_DESC , \n"); selectItem.append(" a.SHIPPLAN_DATE , \n"); selectItem.append(" a.RESERVSHIP_YN , \n"); selectItem.append(" a.ELEC_SAFE , \n"); selectItem.append(" b.kind , \n"); selectItem.append(" b.itemid , \n"); selectItem.append(" b.string1 , \n"); selectItem.append(" b.string2 , \n"); selectItem.append(" b.string3 , \n"); selectItem.append(" b.string4 , \n"); selectItem.append(" b.string5 , \n"); selectItem.append(" b.string6 , \n"); selectItem.append(" b.string7 , \n"); selectItem.append(" b.string8 , \n"); selectItem.append(" b.string9 , \n"); selectItem.append(" b.string10 , \n"); selectItem.append(" b.string11 , \n"); selectItem.append(" b.string12 , \n"); selectItem.append(" b.string13 , \n"); selectItem.append(" b.string14 , \n"); selectItem.append(" b.string15 \n"); selectItem.append(" from ktc_item a ,mirus_detailitem b \n"); selectItem.append(" where a.item_id > 5000000 \n"); selectItem.append(" and a.item_id = b.itemid \n"); selectItem.append(" and a.ven_id in (select ven_id from ktc_vendor where van_status = 120846 ) \n"); // // // 20120109 // //selectItem.append(" and a.std_ctg_id in ( select ctg_id from ktc_stdctg where prnt_ctg_id=5994 ) \n"); // selectItem.append(" and a.item_id = ? \n"); System.out.println("selectItem:" + selectItem.toString()); /* 20120723 */ /* */ try { if (rs != null) try { rs.close(); } catch (Exception e) { } if (pstmt != null) try { pstmt.close(); } catch (Exception e) { } // NaverShopnSendItem_test NaverShopnSendItem_test= new // NaverShopnSendItem_test(); pstmt = conn.prepareStatement(selectItem.toString()); pstmt.setString(1, InputItem); System.out.println("InputItem:" + InputItem); rs = pstmt.executeQuery(); System.out.println("rs:" + rs.getRow()); while (rs.next()) { System.out.println("selectItem in:" + selectItem.toString()); SimpleCryptLib SimpleCryptLib = new SimpleCryptLib(); Security.addProvider(new BouncyCastleProvider()); String accessLicense = "0100010000f3814c41974dc3e7f98d1cd213fa8b84c396872ff6c1abb57f0d2516f31cfb43"; String secretKey = "AQABAADKObge3IgWtlgfbo1TaLqHKpjfyGNKYuZbfOZB8m+WJA=="; String serviceName = "ProductService"; // String id = "eugink"; String password = "asdf0101"; String timestamp = null; String signature = null; String data = null; byte[] encryptKey = null; String encryptedData = null; String decryptedData = null; String hashedData = null; String operationName = "ManageProduct"; String ResponseType = ""; // String orderID = "200087036"; // timestamp create timestamp = SimpleCryptLib.getTimestamp(); System.out.println("timestamp:" + timestamp); System.out.println("ManageProduct"); // generateSign data = timestamp + serviceName + operationName; signature = SimpleCryptLib.generateSign(data, secretKey); // generateKey encryptKey = SimpleCryptLib.generateKey(timestamp, secretKey); // encrypt encryptedData = SimpleCryptLib.encrypt(encryptKey, password.getBytes("UTF-8")); // decrypt decryptedData = new String(SimpleCryptLib.decrypt(encryptKey, encryptedData), "UTF-8"); // sha256 hashedData = SimpleCryptLib.sha256(password); NaverShopnSendItem_test NaverShopnSendItem_test = new NaverShopnSendItem_test(); String ProductId = ""; String item_id = ""; String n_item_id = ""; item_id = rs.getString("co_item_id"); n_item_id = rs.getString("item_id"); /* * CLOB */ // 1.StringBuffer, char[], Reader . StringBuffer stringbuffer = new StringBuffer(); char[] charbuffer = new char[1024]; Reader reader = null; // CLOB . // 2. ResultSet CLOB Reader . reader = rs.getCharacterStream("ITEM_DESC"); int read = 0; // 3. StringBuffer append . 1024 .. while ((read = reader.read(charbuffer, 0, 1024)) != -1) { stringbuffer.append(charbuffer, 0, read); } // 4. StringBuffer append . String rpl_cont = stringbuffer.toString(); // 5. StringBuffer . ( , .) stringbuffer.delete(0, stringbuffer.capacity()); itemlist.append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n "); itemlist.append( "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:shop=\"http://shopn.platform.nhncorp.com/\">"); itemlist.append(" <soap:Header/>"); itemlist.append(" <soap:Body>"); itemlist.append(" <shop:ManageProductRequest>"); itemlist.append(" <shop:RequestID>njoyny2</shop:RequestID>"); itemlist.append(" <shop:AccessCredentials>"); itemlist.append(" <shop:AccessLicense>" + accessLicense + "</shop:AccessLicense>"); itemlist.append(" <shop:Timestamp>" + timestamp + "</shop:Timestamp>"); itemlist.append(" <shop:Signature>" + signature + "</shop:Signature>"); itemlist.append(" </shop:AccessCredentials>"); itemlist.append(" <shop:Version>2.0</shop:Version>"); itemlist.append(" <SellerId>njoyny2</SellerId>"); itemlist.append(" <Product>"); if (item_id != null) { itemlist.append(" <shop:ProductId>" + item_id + "</shop:ProductId>"); // item_id // // :null // :id() } itemlist.append(" <shop:StatusType>" + rs.getString("item_stat_code") + "</shop:StatusType>"); // SALE // () // SUSP() // QSTK()) itemlist.append(" <shop:SaleType>NEW</shop:SaleType>"); // // // // // NEW: // 20130329 if (item_id == null) { itemlist.append( " <shop:CategoryId>" + rs.getString("co_ctg_id") + "</shop:CategoryId>"); // } itemlist.append(" <shop:LayoutType>BASIC</shop:LayoutType>"); // BASIC // : // // IMAGE: // itemlist.append(" <shop:Name><![CDATA[" + NaverShopnSendItem_test.removeXssString( NaverShopnSendItem_test.parsingSpecialforXml(rs.getString("item_name"))) + "]]></shop:Name>"); // itemlist.append(" <shop:SellerManagementCode>" + rs.getString("item_id") + "</shop:SellerManagementCode>"); // itemlist.append(" <shop:Model>"); itemlist.append(" <shop:ManufacturerName><![CDATA[" + rs.getString("MAKING_VEN_CODE") + "]]></shop:ManufacturerName>"); // // itemlist.append(" <shop:BrandName><![CDATA["+ // rs.getString("brand_id") +"]]></shop:BrandName>" ); // // itemlist.append(" </shop:Model>"); itemlist.append(" <shop:OriginArea>"); // // GetOriginAreaList itemlist.append(" <shop:Code>03</shop:Code>"); // // itemlist.append(" </shop:OriginArea>"); itemlist.append(" <shop:TaxType>TAX</shop:TaxType>"); // itemlist.append(" <shop:MinorPurchasable>Y</shop:MinorPurchasable>"); // // */ itemlist.append(" <shop:Image>"); itemlist.append(" <shop:Representative>"); // // 450*450 itemlist.append(" <shop:URL><![CDATA[" + NaverShopnSendItem_test.run2(rs.getString("IMGX")) + "]]></shop:URL>"); // itemlist.append(" <shop:URL><![CDATA[http://beta.shop1.phinf.naver.net/20120829_211/nmp_1346214765097FUx6u_JPEG/45862043648053663_117747847.jpg]]></shop:URL>" // ); itemlist.append(" </shop:Representative>"); itemlist.append(" </shop:Image>"); // String DetailContent = // NaverShopnSendItem_test.parsingSpecialforXml("/ :"+rs.getString("MAKING_VEN_CODE")+"/"+ // rs.getString("ORIGIN_NAME")+"<br>"+ // rs.getString("ITEM_DESC")) ; itemlist.append(" <shop:DetailContent><![CDATA[" + "/ :" + rs.getString("MAKING_VEN_CODE") + "/" + rs.getString("ORIGIN_NAME") + "<br>" + rpl_cont + "]]></shop:DetailContent>"); // // itemlist.append(" <shop:DetailContent><![CDATA["+"/ :"+rs.getString("MAKING_VEN_CODE")+"/"+ // rs.getString("ORIGIN_NAME")+ "" // +"]]></shop:DetailContent>" ); // itemlist.append(" <shop:AfterServiceTelephoneNumber><![CDATA[" + "02-1577-3212" + "]]></shop:AfterServiceTelephoneNumber>"); // AS() itemlist.append(" <shop:AfterServiceGuideContent><![CDATA[" + " ." + "]]></shop:AfterServiceGuideContent>"); // A/S itemlist.append(" <shop:PurchaseReviewExposure>Y</shop:PurchaseReviewExposure>"); // itemlist.append( " <shop:KnowledgeShoppingProductRegistration>Y</shop:KnowledgeShoppingProductRegistration>"); // itemlist.append( " <shop:SalePrice>" + rs.getString("SALE_PRICE") + "</shop:SalePrice>"); // itemlist.append( " <shop:StockQuantity>" + rs.getString("qty") + "</shop:StockQuantity>"); itemlist.append(" <shop:Delivery>"); itemlist.append(" <shop:Type>1</shop:Type>"); itemlist.append(" <shop:BundleGroupAvailable>N</shop:BundleGroupAvailable>"); itemlist.append(" <shop:PayType>2</shop:PayType>"); // 1 3 itemlist.append( " <shop:FeeType>" + rs.getString("low_price_yn") + "</shop:FeeType>"); // 1 3 itemlist.append( " <shop:BaseFee>" + rs.getString("LOW_PRICE_DELY_FEE") + "</shop:BaseFee>"); // itemlist.append( " <shop:ReturnDeliveryCompanyPriority>0</shop:ReturnDeliveryCompanyPriority>"); // itemlist.append(" <shop:ReturnFee>2500</shop:ReturnFee>"); // itemlist.append(" <shop:ExchangeFee>2500</shop:ExchangeFee>"); // itemlist.append(" </shop:Delivery>"); /* * start 20121112 */ itemlist.append(" <shop:ProductSummary>"); // 20121112 if ("3".equals(rs.getString("kind")) || "4".equals(rs.getString("kind"))) { itemlist.append(" <shop:Shoes> "); // ShoesSummaryType itemlist.append(" <shop:Material>:" + rs.getString("string1") + "/:" + rs.getString("string2") + "</shop:Material> "); // itemlist.append(" <shop:Color>" + rs.getString("string3") + "</shop:Color> "); // itemlist.append(" <shop:Size>" + rs.getString("string4") + "</shop:Size> "); // itemlist.append(" <shop:Height>" + rs.getString("string5") + "</shop:Height> "); // itemlist.append(" <shop:Manufacturer>" + rs.getString("string6") + "</shop:Manufacturer> "); // itemlist.append(" <shop:Caution>" + rs.getString("string8") + "</shop:Caution> "); // itemlist.append( " <shop:WarrantyPolicy>" + rs.getString("string9") + "</shop:WarrantyPolicy> "); // itemlist.append( " <shop:AfterServiceDirector>" + "1577-1533" + "</shop:AfterServiceDirector> "); //a/s itemlist.append(" </shop:Shoes> "); // } else if ("1".equals(rs.getString("kind")) || "2".equals(rs.getString("kind"))) { itemlist.append(" <shop:Wear> "); // WearSummaryType itemlist.append(" <shop:Material>" + rs.getString("string1") + "</shop:Material> "); // itemlist.append(" <shop:Color>" + rs.getString("string2") + "</shop:Color> "); // itemlist.append(" <shop:Size>" + rs.getString("string3") + "</shop:Size> "); // itemlist.append(" <shop:Manufacturer>" + rs.getString("string4") + "</shop:Manufacturer> "); // itemlist.append(" <shop:Caution>" + rs.getString("string6") + "</shop:Caution> "); // //itemlist.append(" <shop:PackDate> string </shop:PackDate> "); // itemlist.append(" <shop:PackDateText>" + rs.getString("string7") + "</shop:PackDateText> "); // itemlist.append( " <shop:WarrantyPolicy>" + rs.getString("string8") + "</shop:WarrantyPolicy> "); // itemlist.append( " <shop:AfterServiceDirector>" + "1577-1533" + "</shop:AfterServiceDirector> "); //a/s itemlist.append(" </shop:Wear>"); // } else if ("5".equals(rs.getString("kind")) || "6".equals(rs.getString("kind"))) { itemlist.append(" <shop:Bag> "); // BagSummaryType itemlist.append(" <shop:Type>" + rs.getString("string1") + "</shop:Tye> "); // itemlist.append(" <shop:Material>" + rs.getString("string2") + "</shop:Material> "); // itemlist.append(" <shop:Color>" + rs.getString("string3") + "</shop:Color> "); // itemlist.append(" <shop:Size>" + rs.getString("string4") + "</shop:Size> "); // itemlist.append(" <shop:Manufacturer>" + rs.getString("string5") + "</shop:Manufacturer> "); // itemlist.append(" <shop:Caution>" + rs.getString("string7") + "</shop:Caution> "); // itemlist.append( " <shop:WarrantyPolicy>" + rs.getString("string8") + "</shop:WarrantyPolicy> "); // itemlist.append( " <shop:AfterServiceDirector>" + "1577-1533" + "</shop:AfterServiceDirector> "); //a/s itemlist.append(" </shop:Wear>"); // } else if ("7".equals(rs.getString("kind")) || "8".equals(rs.getString("kind"))) { itemlist.append(" <shop:FashionItems> "); // FashionItemsSummaryType itemlist.append(" <shop:Type>" + rs.getString("string1") + "</shop:Tye> "); // itemlist.append(" <shop:Material>" + rs.getString("string2") + "</shop:Material> "); // itemlist.append(" <shop:Size>" + rs.getString("string3") + "</shop:Size> "); // itemlist.append(" <shop:Manufacturer>" + rs.getString("string4") + "</shop:Manufacturer> "); // itemlist.append(" <shop:Caution>" + rs.getString("string6") + "</shop:Caution> "); // itemlist.append( " <shop:WarrantyPolicy>" + rs.getString("string7") + "</shop:WarrantyPolicy> "); // itemlist.append( " <shop:AfterServiceDirector>" + "1577-1533" + "</shop:AfterServiceDirector> "); //a/s itemlist.append(" </shop:FashionItems>"); // } else if ("13".equals(rs.getString("kind")) || "14".equals(rs.getString("kind"))) { itemlist.append(" <shop:HomeAppliances> "); //() HomeAppliancesSummaryType itemlist.append(" <shop:ItemName>" + rs.getString("string1") + "</shop:ItemName> "); // itemlist.append(" <shop:ModelName>" + rs.getString("string1") + "</shop:ModelName> "); // //itemlist.append(" <shop:Certified> string </shop:Certified> "); // itemlist.append(" <shop:RatedVoltage>" + rs.getString("string3") + "</shop:RatedVoltage> "); // itemlist.append( " <shop:PowerConsumption>" + rs.getString("string3") + "</shop:PowerConsumption> "); // itemlist.append(" <shop:EnergyEfficiencyRating>" + rs.getString("string3") + "</shop:EnergyEfficiencyRating> "); // itemlist.append(" <shop:ReleaseDate>" + rs.getString("string4") + "</shop:ReleaseDate> "); // 'yyyy-mm' itemlist.append(" <shop:Manufacturer>" + rs.getString("string5") + "</shop:Manufacturer> "); // itemlist.append(" <shop:Size>" + rs.getString("string7") + "</shop:Size> "); // itemlist.append( " <shop:WarrantyPolicy>" + rs.getString("string8") + "</shop:WarrantyPolicy> "); // itemlist.append( " <shop:AfterServiceDirector>" + "1577-1533" + "</shop:AfterServiceDirector> "); //a/s itemlist.append(" </shop:HomeAppliances>"); //() } else if ("17".equals(rs.getString("kind")) || "18".equals(rs.getString("kind"))) { itemlist.append(" <shop:MedicalAppliances> "); // MedicalAppliancesSummaryType itemlist.append(" <shop:ItemName>" + rs.getString("string1") + "</shop:ItemName> "); // itemlist.append(" <shop:ModelName>" + rs.getString("string1") + "</shop:ModelName> "); // itemlist.append(" <shop:LicenceNo>" + rs.getString("string2") + "</shop:LicenceNo> "); // //itemlist.append(" <shop:AdvertisingCertified> string </shop:AdvertisingCertified> "); // //itemlist.append(" <shop:Certified> string </shop:Certified> "); //kc itemlist.append(" <shop:RatedVoltage>" + rs.getString("string4") + "</shop:RatedVoltage> "); // itemlist.append( " <shop:PowerConsumption>" + rs.getString("string4") + "</shop:PowerConsumption> "); // itemlist.append(" <shop:ReleaseDate>" + rs.getString("string5") + "</shop:ReleaseDate> "); // 'yyyy-mm' itemlist.append(" <shop:Manufacturer>" + rs.getString("string6") + "</shop:Manufacturer> "); // itemlist.append(" <shop:Purpose>" + rs.getString("string8") + "</shop:Purpose> "); // itemlist.append(" <shop:Usage><![CDATA[" + rs.getString("string8") + "]]></shop:Usage> "); // itemlist.append(" <shop:Caution>" + rs.getString("string9") + "</shop:Caution> "); // itemlist.append( " <shop:WarrantyPolicy>" + rs.getString("string10") + "</shop:WarrantyPolicy> "); // itemlist.append( " <shop:AfterServiceDirector>" + "1577-1533" + "</shop:AfterServiceDirector> "); //a/s itemlist.append(" </shop:MedicalAppliances>"); // } else if ("11".equals(rs.getString("kind")) || "12".equals(rs.getString("kind"))) { itemlist.append(" <shop:Cosmetic>"); // CosmeticSummaryType itemlist.append(" <shop:Capacity>" + rs.getString("string1") + "</shop:Capacity> "); // itemlist.append( " <shop:Specification>" + rs.getString("string2") + "</shop:Specification> "); // //itemlist.append(" <shop:ExpirationDate> string </shop:ExpirationDate> "); // itemlist.append(" <shop:ExpirationDateText>" + rs.getString("string3") + "</shop:ExpirationDateText> "); // () itemlist.append(" <shop:Usage><![CDATA[" + rs.getString("string4") + "]]></shop:Usage> "); // itemlist.append(" <shop:Manufacturer>" + rs.getString("string5") + "</shop:Manufacturer> "); // itemlist.append(" <shop:Distributor>" + rs.getString("string5") + "</shop:Distributor> "); // itemlist.append( " <shop:MainIngredient>" + rs.getString("string7") + "</shop:MainIngredient> "); // //itemlist.append(" <shop:Certified> string </shop:Certified> "); // Y,N itemlist.append(" <shop:Caution>" + rs.getString("string9") + "</shop:Caution> "); // itemlist.append( " <shop:WarrantyPolicy>" + rs.getString("string10") + "</shop:WarrantyPolicy> "); // itemlist.append(" <shop:CustomerServicePhoneNumber>" + "1577-1533" + "</shop:CustomerServicePhoneNumber> "); // itemlist.append(" </shop:Cosmetic>"); // } else if ("9".equals(rs.getString("kind")) || "10".equals(rs.getString("kind"))) { itemlist.append(" <shop:Jewellery> "); // JewellerySummaryType itemlist.append(" <shop:Material>" + rs.getString("string1") + "</shop:Material> "); // itemlist.append(" <shop:Purity>" + rs.getString("string1") + "</shop:Purity> "); // itemlist.append(" <shop:BandMaterial>" + rs.getString("string1") + "</shop:BandMaterial> "); // itemlist.append(" <shop:Weight>" + rs.getString("string2") + "</shop:Weight> "); // itemlist.append(" <shop:Manufacturer>" + rs.getString("string3") + "</shop:Manufacturer> "); // itemlist.append(" <shop:Producer>" + rs.getString("string4") + "</shop:Producer> "); // itemlist.append(" <shop:Size>" + rs.getString("string5") + "</shop:Size> "); // itemlist.append(" <shop:Caution>" + rs.getString("string6") + "</shop:Caution> "); // itemlist.append( " <shop:Specification>" + rs.getString("string7") + "</shop:Specification> "); // //itemlist.append(" <shop:ProvideWarranty>" + rs.getString("string8") + "</shop:ProvideWarranty> "); // Y,N itemlist.append(" <shop:ProvideWarranty>N</shop:ProvideWarranty> "); // Y,N itemlist.append( " <shop:WarrantyPolicy>" + rs.getString("string9") + "</shop:WarrantyPolicy> "); // itemlist.append( " <shop:AfterServiceDirector>" + "1577-1533" + "</shop:AfterServiceDirector> "); //a/s itemlist.append(" </shop:Jewellery>"); // } else if ("15".equals(rs.getString("kind")) || "16".equals(rs.getString("kind"))) { itemlist.append(" <shop:DietFood> "); // DietFoodSummaryType itemlist.append(" <shop:FoodType>" + rs.getString("string1") + "</shop:FoodType> "); // itemlist.append(" <shop:Producer>" + rs.getString("string2") + "</shop:Producer> "); // itemlist.append(" <shop:Location>" + rs.getString("string2") + "</shop:Location> "); // //itemlist.append(" <shop:PackDate> string </shop:PackDate> "); // itemlist.append(" <shop:PackDateText>" + rs.getString("string3") + "</shop:PackDateText> "); //() //itemlist.append(" <shop:ExpirationDate> string </shop:ExpirationDate> "); // itemlist.append(" <shop:ExpirationDateText>" + rs.getString("string3") + "</shop:ExpirationDateText> "); // () itemlist.append(" <shop:Weight>" + rs.getString("string4") + "</shop:Weight> "); // itemlist.append(" <shop:Amount>" + rs.getString("string4") + "</shop:Amount> "); // itemlist.append(" <shop:Ingredients>" + rs.getString("string5") + "</shop:Ingredients> "); // itemlist.append( " <shop:NutritionFacts>" + rs.getString("string6") + "</shop:NutritionFacts> "); // itemlist.append( " <shop:Specification>" + rs.getString("string7") + "</shop:Specification> "); // itemlist.append(" <shop:CautionAndSideEffect>" + rs.getString("string8") + "</shop:CautionAndSideEffect> "); //, itemlist.append(" <shop:NonMedicinalUsesMessage>" + rs.getString("string9") + "</shop:NonMedicinalUsesMessage> "); // itemlist.append(" <shop:GeneticallyModified>" + rs.getString("string10") + "</shop:GeneticallyModified> "); // y,n //itemlist.append(" <shop:AdvertisingCertified> string </shop:AdvertisingCertified> "); // itemlist.append(" <shop:ImportDeclarationCheck>" + rs.getString("string12") + "</shop:ImportDeclarationCheck> "); // y,n itemlist.append(" <shop:CustomerServicePhoneNumber>" + "1577-1533" + "</shop:CustomerServicePhoneNumber> "); // itemlist.append(" </shop:DietFood> "); // } /* * end 20121112 */ itemlist.append(" </shop:ProductSummary>"); itemlist.append(" </Product>"); itemlist.append(" </shop:ManageProductRequest>"); itemlist.append(" </soap:Body>"); itemlist.append(" </soap:Envelope>"); System.out.println("itemlist.toString():" + itemlist.toString()); /************************************/ int pre_cnt = 0; StringBuffer unitCnt1 = new StringBuffer(); unitCnt1.append(" select count(*) cnt \n"); unitCnt1.append(" from ( \n"); unitCnt1.append( " select nvl(b.coven_id,0) coven_id,a.unit_name,nvl(b.co_unit_id,0) co_unit_id,a.unit_id,a.vir_stock_qty,decode(a.use_yn,'Y','Y','N') use_yn \n"); unitCnt1.append(" from ktc_unit a,ktc_unit_interlock b \n"); unitCnt1.append(" where a.unit_id = b.unit_id(+) \n"); unitCnt1.append(" and a.unit_name is not null \n"); unitCnt1.append(" and a.item_id = ? \n"); unitCnt1.append(" )where coven_id in (27346) \n"); try { PreparedStatement pstmt3 = null; ResultSet rs3 = null; pstmt3 = conn.prepareStatement(unitCnt1.toString()); pstmt3.setString(1, n_item_id); // h_order_no rs3 = pstmt3.executeQuery(); while (rs3.next()) { pre_cnt = rs3.getInt("cnt"); } /*if (pre_cnt > 0) { NaverShopnSendItem_test.run4(item_id, n_item_id, pre_cnt); // }*/ if (rs3 != null) try { rs3.close(); } catch (Exception e) { } if (pstmt3 != null) try { pstmt3.close(); } catch (Exception e) { } } catch (Exception e) { System.out.println("() : " + e.getMessage()); } finally { } /**********************************/ if (item_id != null && pre_cnt > 0) { // . try { StringBuffer unitCnt = new StringBuffer(); unitCnt.append(" select count(*) cnt \n"); unitCnt.append(" from ( \n"); unitCnt.append( " select decode(b.coven_id,27346,b.coven_id,0) coven_id,a.unit_name,decode(b.coven_id,27346,b.co_unit_id,0) co_unit_id,a.unit_id,a.vir_stock_qty,decode(a.use_yn,'Y','Y','N') use_yn \n"); unitCnt.append(" from ktc_unit a,ktc_unit_interlock b \n"); unitCnt.append(" where a.unit_id = b.unit_id(+) \n"); unitCnt.append(" and a.unit_name is not null \n"); unitCnt.append(" and a.item_id = ? \n"); unitCnt.append(" )where coven_id in (27346,0) \n"); System.out.println(" !!!!!!!!!!!!"); try { PreparedStatement pstmt3 = null; ResultSet rs3 = null; pstmt3 = conn.prepareStatement(unitCnt.toString()); pstmt3.setString(1, n_item_id); // h_order_no rs3 = pstmt3.executeQuery(); int cnt = 0; while (rs3.next()) { cnt = rs3.getInt("cnt"); } if (cnt > 0) { NaverShopnSendItem_test.run4(item_id, n_item_id, cnt); // } if (rs3 != null) try { rs3.close(); } catch (Exception e) { } if (pstmt3 != null) try { pstmt3.close(); } catch (Exception e) { } } catch (Exception e) { System.out.println("() : " + e.getMessage()); } finally { } } catch (Exception e) { System.out.println("() : " + e.getMessage()); } finally { } } String line_total = ""; URL url = new URL("http://ec.api.naver.com/ShopN/ProductService"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoOutput(true); con.setRequestMethod("POST"); con.setDoOutput(true); // . true. con.setDoInput(true); con.setUseCaches(false); con.setDefaultUseCaches(false); // Header con.addRequestProperty("Content-Type", "text/xml;charset=UTF-8"); // BODY OutputStreamWriter wr = new OutputStreamWriter(con.getOutputStream(), "UTF-8"); wr.write(itemlist.toString()); wr.flush(); // String inputLine = null; BufferedReader rd = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); while ((inputLine = rd.readLine()) != null) { line_total = line_total + inputLine; System.out.println(inputLine); } rd.close(); wr.close(); line_total = line_total.replaceAll("n:", ""); //System.out.println(line_total); // xml2 InputStream in = new ByteArrayInputStream(line_total.getBytes("UTF-8")); SAXBuilder builder = new SAXBuilder(); Document document = builder.build(in); Element element = document.getRootElement(); List envel_list = element.getChildren(); //System.out.println("envel_list:" + envel_list); List body_list = null; List body_list1 = null; List result_list = null; List result_list1 = null; List result_list2 = null; List result_list3 = null; List result_list4 = null; List result_list5 = null; List info_list = null; List contr_group_list = null; List contr_info_list = null; PreparedStatement pstmt2 = null; ResultSet rs2 = null; CallableStatement cStmt2 = null; Element envel_el = (Element) envel_list.get(0); body_list = envel_el.getChildren(); Element body_el = (Element) body_list.get(0); result_list = body_el.getChildren("ManageProductResponse"); ResponseType = body_el.getChildText("ResponseType"); ProductId = body_el.getChildText("ProductId"); System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); System.out.println("ResponseType:" + ResponseType); System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); if (ResponseType.equals("SUCCESS")) { if (item_id == null) { StringBuffer setCovenID = new StringBuffer(); setCovenID.append( " insert into ktc_item_interlock(coven_id , co_item_id , item_id ,insert_date,update_date) \n"); setCovenID.append(" values (27346,?,?,sysdate,sysdate) \n"); pstmt2 = conn.prepareStatement(setCovenID.toString()); int insert_cnt = 0; try { // pstmt2.clearParameters(); // pstmt2.setString(1, ProductId); //id pstmt2.setString(2, n_item_id); // h_order_no System.out.println("ProductId:" + ProductId); System.out.println("n_item_id:" + n_item_id); pstmt2.executeUpdate(); System.out.println("end insert"); if (rs2 != null) try { rs2.close(); } catch (Exception e) { } if (pstmt2 != null) try { pstmt2.close(); } catch (Exception e) { } } catch (Exception e) { response_type = "FALSE"; e.printStackTrace(); conn.rollback(); } } else { StringBuffer setCovenID = new StringBuffer(); setCovenID.append(" update ktc_item_interlock set \n"); setCovenID.append(" update_date = sysdate \n"); setCovenID.append(" where coven_id = 27346 and item_id = ? \n"); int insert_cnt = 0; pstmt2 = conn.prepareStatement(setCovenID.toString()); try { // pstmt2.clearParameters(); // pstmt2.setString(1, n_item_id); // h_order_no pstmt2.executeUpdate(); System.out.println("end update22"); if (rs2 != null) try { rs2.close(); } catch (Exception e) { } if (pstmt2 != null) try { pstmt2.close(); } catch (Exception e) { } } catch (Exception e) { System.out.println("error() : " + e.getMessage()); response_type = "FALSE"; e.printStackTrace(); conn.rollback(); } } } if (rs2 != null) try { rs2.close(); } catch (Exception e) { } if (pstmt2 != null) try { pstmt2.close(); } catch (Exception e) { } System.out.println("pre_cnt:" + pre_cnt); if (item_id == null || pre_cnt == 0) { //item_id StringBuffer unitCnt = new StringBuffer(); System.out.println("!!!!"); unitCnt.append(" select count(*) cnt \n"); unitCnt.append(" from ( \n"); unitCnt.append( " select decode(b.coven_id,27346,b.coven_id,0) coven_id,a.unit_name,decode(b.coven_id,27346,b.co_unit_id,0) co_unit_id,a.unit_id,a.vir_stock_qty,decode(a.use_yn,'Y','Y','N') use_yn \n"); unitCnt.append(" from ktc_unit a,ktc_unit_interlock b \n"); unitCnt.append(" where a.unit_id = b.unit_id(+) \n"); unitCnt.append(" and a.unit_name is not null \n"); unitCnt.append(" and a.item_id = ? \n"); unitCnt.append(" )where coven_id in (27346,0) \n"); System.out.println("n_item_id:" + n_item_id); try { PreparedStatement pstmt3 = null; ResultSet rs3 = null; pstmt3 = conn.prepareStatement(unitCnt.toString()); pstmt3.setString(1, n_item_id); // h_order_no rs3 = pstmt3.executeQuery(); int cnt = 0; while (rs3.next()) { cnt = rs3.getInt("cnt"); } if (cnt > 0) { if (pre_cnt == 0) { System.out.println("ProductId:" + item_id); System.out.println("n_item_id:" + n_item_id); System.out.println("cnt:" + cnt); NaverShopnSendItem_test.run4(ProductId, n_item_id, cnt); // insert } else { NaverShopnSendItem_test.run4(ProductId, n_item_id, cnt); // update System.out.println("update end"); } } if (rs3 != null) try { rs3.close(); } catch (Exception e) { } if (pstmt3 != null) try { pstmt3.close(); } catch (Exception e) { } } catch (Exception e) { System.out.println("() : " + e.getMessage()); } finally { } } } //System.out.println("itemlist:" + itemlist.toString()); if (rs != null) { try { rs.close(); } catch (Exception e) { response_type = "FALSE"; } } if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { response_type = "FALSE"; } } } catch (Exception e) { System.out.println("run_1() : " + e.getMessage()); } finally { } /* */ } catch (Exception e) { System.out.println("run_2() : " + e.getMessage()); response_type = "FALSE"; } finally { } return response_type; }
From source file:SELSKeyGen.java
License:Open Source License
public static void main(String[] args) throws Exception { Security.addProvider(new BouncyCastleProvider()); if (args.length > 1) { String type = args[0];/*from w w w.ja v a 2 s .co m*/ SELS_LIST_PATH = args[1]; if (!(type.equals("GENPARAMS"))) initPGQ(); if (type.equals("LM")) LMKeyGen(args[2], args[3], Integer.parseInt(args[4])); else if (type.equals("LS")) LSKeyGen(args[2], args[3], Integer.parseInt(args[4])); else if (type.equals("USER")) userKeyGen(args[2], args[3], "", "", args[4], args[5], Integer.parseInt(args[6])); else if (type.equals("CUSER")) CKeyGen(args[2], args[3], args[4], Integer.parseInt(args[5])); //else if (type.equals("GENPARAMS")) // GenParamsBC(); else if (type.equals("GENPARAMS")) GenParams(Integer.parseInt(args[2])); //else if(type.equals("testinit")) // initPGQ(); } else { java.util.Properties prop = new java.util.Properties(); prop.load(System.in); String type = prop.getProperty("type"); SELS_LIST_PATH = prop.getProperty("listPath"); String userId = prop.getProperty("userId"); String subuserId = prop.getProperty("subuserId"); String servuserId = prop.getProperty("servuserId"); String subuserIdHash = prop.getProperty("subuserIdHash"); String servuserIdHash = prop.getProperty("servuserIdHash"); String LSPass = prop.getProperty("LSPass"); String LMPass = prop.getProperty("LMPass"); String userPass = prop.getProperty("userPass"); String LKPass = prop.getProperty("LKPass"); String randomStr = prop.getProperty("randStr"); String expsecstr = prop.getProperty("expsec"); String keysize = prop.getProperty("keysize"); if (!type.equals("GENPARAMS")) initPGQ(); if (type.equals("LM")) LMKeyGen(userId, LMPass, Integer.parseInt(expsecstr)); else if (type.equals("LS")) LSKeyGen(userId, LSPass, Integer.parseInt(expsecstr)); else if (type.equals("USER")) userKeyGen(subuserId, servuserId, subuserIdHash, servuserIdHash, LMPass, userPass, Integer.parseInt(expsecstr)); else if (type.equals("CUSER")) CKeyGen(userId, randomStr, LSPass, Integer.parseInt(expsecstr)); else if (type.equals("LK")) LKKeyGen(userId, LKPass, Integer.parseInt(expsecstr)); //else if (type.equals("GENPARAMS")) // GenParamsBC(); else if (type.equals("GENPARAMS")) GenParams(Integer.parseInt(keysize)); } }
From source file:NaverShopnGetOrder.java
/** * /* www . j a va2 s . c om*/ * @param serviceName * @param operationName * @throws Exception */ public void encryptInit(String serviceName, String operationName) throws Exception { this.setServiceName(serviceName); this.setOperationName(operationName); Security.addProvider(new BouncyCastleProvider()); this.setTimestamp(SimpleCryptLib.getTimestamp()); this.setData(this.getTimestamp() + this.getServiceName() + this.getOperationName()); //generateSign this.setSignature(SimpleCryptLib.generateSign(this.getData(), this.getSecretKey())); //generateKey this.setEncryptKey(SimpleCryptLib.generateKey(this.getTimestamp(), this.getSecretKey())); //encrypt this.setEncryptedData(SimpleCryptLib.encrypt(this.getEncryptKey(), this.getPassword().getBytes("UTF-8"))); this.setDecryptedData( new String(SimpleCryptLib.decrypt(this.getEncryptKey(), this.getEncryptedData()), "UTF-8")); this.setHashedData(SimpleCryptLib.sha256(this.getPassword())); System.out.println("accessLicense : [" + this.getAccessLicense() + "]"); System.out.println("secretKey : [" + this.getSecretKey() + "]"); System.out.println("serviceName : [" + this.getServiceName() + "]"); System.out.println("operationName : [" + this.getOperationName() + "]"); System.out.println("timestamp : [" + this.getTimestamp() + "]"); System.out.println("signature : [" + this.getSignature() + "]"); System.out.println("encryptKey : [" + new String(Hex.encode(this.getEncryptKey())) + "]"); System.out.println("encryptedData : [" + this.getEncryptedData() + "]"); System.out.println("decryptedData : [" + this.getDecryptedData() + "]"); System.out.println("sha256Data : [" + this.getHashedData() + "]"); System.out.println("[==============================================================]"); System.out.println("[==============================================================]"); System.out.println("[==================encryptInit()===============================]"); System.out.println("[==================encryptInit()===============================]"); System.out.println("[==============================================================]"); System.out.println("[==============================================================]"); }
From source file:NaverShopnSendShipping.java
public void encryptInit(String serviceName, String operationName) throws Exception { this.setServiceName(serviceName); this.setOperationName(operationName); Security.addProvider(new BouncyCastleProvider()); this.setTimestamp(SimpleCryptLib.getTimestamp()); this.setData(this.getTimestamp() + this.getServiceName() + this.getOperationName()); //generateSign this.setSignature(SimpleCryptLib.generateSign(this.getData(), this.getSecretKey())); //generateKey this.setEncryptKey(SimpleCryptLib.generateKey(this.getTimestamp(), this.getSecretKey())); //encrypt/*from w ww.j a v a2 s . c om*/ this.setEncryptedData(SimpleCryptLib.encrypt(this.getEncryptKey(), this.getPassword().getBytes("UTF-8"))); this.setDecryptedData( new String(SimpleCryptLib.decrypt(this.getEncryptKey(), this.getEncryptedData()), "UTF-8")); this.setHashedData(SimpleCryptLib.sha256(this.getPassword())); System.out.println("accessLicense : [" + this.getAccessLicense() + "]"); System.out.println("secretKey : [" + this.getSecretKey() + "]"); System.out.println("serviceName : [" + this.getServiceName() + "]"); System.out.println("operationName : [" + this.getOperationName() + "]"); System.out.println("timestamp : [" + this.getTimestamp() + "]"); System.out.println("signature : [" + this.getSignature() + "]"); System.out.println("encryptKey : [" + new String(Hex.encode(this.getEncryptKey())) + "]"); System.out.println("encryptedData : [" + this.getEncryptedData() + "]"); System.out.println("decryptedData : [" + this.getDecryptedData() + "]"); System.out.println("sha256Data : [" + this.getHashedData() + "]"); System.out.println("[==============================================================]"); System.out.println("[==============================================================]"); System.out.println("[==================encryptInit()===============================]"); System.out.println("[==================encryptInit()===============================]"); System.out.println("[==============================================================]"); System.out.println("[==============================================================]"); }