private void sendUserUpdate(String update_type, String urlStr) { m_LogFile.log("Finding pending data, where update type = " + update_type + "......."); try { Vector uQueue = findUpdates(update_type); if (uQueue != null && uQueue.size() > 0) { int qsize = uQueue.size(); System.out.println("send User Update====" + qsize); for (int x = 0; x < qsize; x++) { System.out.println("####################User Update: " + x); try { ECommerceUpdate oneUpdate = (ECommerceUpdate) uQueue.elementAt(x); String request = ""; String result = ""; try { request = buildUserRequest(oneUpdate); String requestMAC = JSUtils.ReqAddMAC_Hex(request, secretPattern); int attempt = 0; do { WebQuery query = new WebQuery(urlStr); System.out.println("aaaaaaaaarequestMAC====" + requestMAC); m_LogFile.log("requestMAC====" + requestMAC); try { result = query.query(requestMAC); attempt = m_RetryNum; } catch (Exception whoa) { whoa.printStackTrace(); result = "Result=301&error=from ecommerce: " + whoa.getMessage(); attempt++; try { Thread.sleep(m_RetryInterval); } catch (InterruptedException e1) { } } } while (attempt < m_RetryNum); } catch (IllegalArgumentException e) { result = "Result=301&error=from Rcopia: " + e.getMessage(); e.printStackTrace(); } System.out.println("aaaaaaresult========" + result); m_LogFile.log("result============" + result); recordStatus(oneUpdate, result); } catch (Exception e) { e.printStackTrace(); m_LogFile.log(e); } } } } catch (Exception e) { e.printStackTrace(); } }
private String sendDirectSSLMessage(URL url, String message) throws IOException { String result = ""; StringBuffer buffer = new StringBuffer(); String urlStr = ""; urlStr = url.toString(); System.out.println("url is: " + urlStr); System.out.println("message is: " + message); // WebQuery query = new WebQuery(urlStr); webQuery.setUrl(urlStr); result = webQuery.query(message); System.out.println("result is: " + result); return result; }